Code:
import java.util.*;
public class X{
private Date start;
private Date end;
public X(){
start = new Date(20911); // public Date(int year, int month, int day) deprecated
end = new Date(20921); // public Date(String s) deprecated
dateChecker(end);
}
public static void main(String[] args){
new X();
}
private void dateChecker(Date end){
int i = start.compareTo(end);
switch(i){
case -1:{System.out.println("start is before end");}
break;
case 0:{System.out.println("Same dates");}
break;
case 1:{System.out.println("start is after end");}
break;
}
}
}