- public int compare(Date date){
- if(year > date.year) {
- return 1;
- }else {
- if(year < date.year){
- return -1;
- }else {
- if(month > date.month) {
- return 1;
- }else {
- if(month < date.month) {
- return -1;
- }else {
- if(day > date.day) {
- return 1;
- }else {
- if(day < date.day) {
- return -1;
- }else {
- return 0;
- }
- }
- }
- }
- }
- }
- }
- //好像应该是这样的吧
复制代码
|