解决方案 »

  1.   

    List不是这么排序的
    Collections.sort(list,Comparable)
      

  2.   

    楼主这种比较是实体类自身实现Comparable接口又称内部比较,List是有序的集合,不会调用内部比较进行排序的。要么你不用ArrayList,改用TreeSet你要排序List可以用外部比较器Collections.sort(list,new Comparator<Student>(){
        public int compare(Student s1,Student s2){//自己重写和你的Comparable的compareTo方法一样
        }
        public boolean equals(Student s){}
    })
      

  3.   

    Iterator只是用来迭代的,并不是用来排序的。
    你这里要排序用:Collections.sort(list)
      

  4.   

    public class chapters1301{
        public static void main(String agrs[]){
             List<Student> allList = new ArrayList<Student>();
     Collections.addAll(allList,new Student("张三",21,84));
     Collections.addAll(allList,new Student("李四",23,80));
     Collections.addAll(allList,new Student("王五",22,89));
     Collections.addAll(allList,new Student("孙琦",19,100));
     Collections.addAll(allList,new Student("赵妞",20,75));
      Collections.sort(allList);
      Iterator<Student> iter=allList.iterator() ;
              while(iter.hasNext()){
          System.out.println(iter.next()+",");
      }
    }
     }
    这样就对了!!哈哈谢谢
      

  5.   

    恩,该用TreeSet也能实现!!谢谢