package com.lwj;public class TestDateArraySort { public static void main(String[] args) {
DateDay[] date = new DateDay[5];
date[0] = new DateDay(2008, 07, 06);
date[1] = new DateDay(2008, 07, 07);
date[2] = new DateDay(2008, 07, 08);//错误 the literal octal 08 (digit 8) of type int out of range
date[3] = new DateDay(2008, 07, 09);//错误 the literal octal 08 (digit 8) of type int out of range
date[4] = new DateDay(2008, 07, 10);
bubbleSort(date);
for (int i = 0; i < date.length; i++)
System.out.println(date[i]);
} public static DateDay[] bubbleSort(DateDay[] a) {
int len = a.length;
for (int i = len - 1; i >= 1; i--) {
for (int j = 0; j <= i - 1; j++) {
if (a[j].compare(a[j + 1]) > 0) {
DateDay temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
}
return a;
}}class DateDay {
private int year; private int month; private int day; DateDay(int year, int month, int day) {
this.day = day;
this.month = month;
this.year = year;
} public int compare(DateDay date) {
return year > date.year ? 1 : year < date.year ? -1
: month > date.month ? 1 : month < date.month ? -1
: day > date.day ? 1 : day > date.day ? 1 : 0; } public String toString() {
return "year" + year + " month " + month + " day " + day;
}
}
这是什么错误?