import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Demo {
static class Student implements Comparable{
x05 String name;
x05 int age;
x05public Student(String name,int age) {
x05x05super();
x05x05this.name = name;
x05x05this.age = age;
x05}
x05@Override
x05public String toString() {
x05x05return name+","+age;
x05}
x05@Override
x05public int compareTo(Object o) {
x05x05Student stu = (Student)o;
x05x05if(this.age>stu.age){
x05x05x05return 1;
x05x05}
x05x05else if(this.age==stu.age && this.name.equals(stu.name)){
x05x05 return 0;
x05x05}
x05x05else{
x05x05x05return -1;
x05x05}
x05}
x05/*@Override
x05public int compareTo(Student o) {
x05x05Student stu = (Student)o;
x05x05if(this.age>stu.age){
x05x05x05return 1;
x05x05}
x05x05else if(this.age==stu.age && this.name.equals(stu.name)){
x05x05 return 0;
x05x05}
x05x05else{
x05x05x05return -1;
x05x05}
x05}*/
}
public static void main(String[] args) {
x05 List list = new ArrayList();
x05 Student[] stus = new Student[]{new Student("小美",21),
x05x05x05x05new Student("阿聪",22),new Student("武大郎",28),
x05x05x05x05new Student("阮小七",26),new Student("晁盖",30),
x05x05x05x05new Student("鲁智深",29),new Student("孙二娘",26),
x05x05x05x05new Student("扈三娘",23),new Student("武松",24)
x05x05};
Collections.addAll(list,stus);
Collections.sort(list);
for(int i = 0;i