日期:2014-05-20  浏览次数:20637 次

一段很简单的额代码,但是就是显示有错误
import   java.util.*;
public   class   TestSort
{
public   class   void   main(String   []   args)
{
ArrayList   al=new   ArrayList();
al.add(new   Integer(1));
al.add(new   Integer(3));
al.add(new   Integer(2));
System.out.println(al.toString());
Collection.Sort(al);
    System.out.println(al.toString());
}
}

------解决方案--------------------
import java.util.*;
public class TestSort
{
public static void main(String [] args) //static
{
ArrayList al=new ArrayList();
al.add(new Integer(1));
al.add(new Integer(3));
al.add(new Integer(2));
System.out.println(al.toString());
Collections.sort(al); //Collections.sort
System.out.println(al.toString());
}
}