public class TestD {
public static void main(String args[]) {
int a[] ;
a = new int[3] ;
a[0] = 0 ;
a[1] = 1 ;
a[2] = 2 ;
Date days[] ;
days = new Date[3] ;
days[0] = new Date(2010,7,5) ;
days[1] = new Date(2017,2,5) ;
days[2] = new Date(2008,3,4) ;
}
}
class Date {
int year,month,day ;
Date(int year ,int month ,int day) {
this.year = year ;
this.month = month ;
this.day = day ;
}
}
Arrays.sort()只能对数组(基本类型数组和类数组)进行排序,不能对List进行排序,对List排序需要用Collections.sort()方法