class myDate{ private int year=1900; private int month=1; private int day=1; myDate(){ } myDate(int year,int month,int day){ this.year=year; this.month=month; this.day=day; } public int getYear(){ return year; } public int getMonth(){ return month; } pulbic int getDay(){ return day; } public boolean equals(myDate date){ return year==date.getYear()&&month==date.getMonth()&&day==date.getDay(); } public int compareTo(myDate date){ java.util.Calendar cal=new java.util.Calendar(); cal=set(year,month,day); long longThis=cal.getTimeInMillis(); cal=set(date.getYear(),date.getMonth(),date.getDay()); long longCompared=cal.getTimeInMillis(); return (int)(longThis-longCompared)/(60*60*24); } }
private int year=1900;
private int month=1;
private int day=1;
myDate(){
}
myDate(int year,int month,int day){
this.year=year;
this.month=month;
this.day=day;
}
public int getYear(){
return year;
}
public int getMonth(){
return month;
}
pulbic int getDay(){
return day;
}
public boolean equals(myDate date){
return year==date.getYear()&&month==date.getMonth()&&day==date.getDay();
}
public int compareTo(myDate date){
java.util.Calendar cal=new java.util.Calendar();
cal=set(year,month,day);
long longThis=cal.getTimeInMillis();
cal=set(date.getYear(),date.getMonth(),date.getDay());
long longCompared=cal.getTimeInMillis();
return (int)(longThis-longCompared)/(60*60*24);
}
}