java.util.Date is limited to the year range (1970 - 2037) and this is inconvenient when working with historic data, birthdates, etc. A runtime exception of java.lang.IllegalArgumentException: year out of range is thrown when an incorrect year is used.
Here is a test case :
import java.util.*;
public class DateTest
{
public static void main (String[] args)
{
// set the year at 2038
Date mybd = new Date(138, 10, 15);
System.out.println("Year : " + mybd.getYear());
System.out.println("Month : " + mybd.getMonth());
System.out.println("Day : " + mybd.getDay());
System.exit(0);
}
}
Here is a test case :
import java.util.*;
public class DateTest
{
public static void main (String[] args)
{
// set the year at 2038
Date mybd = new Date(138, 10, 15);
System.out.println("Year : " + mybd.getYear());
System.out.println("Month : " + mybd.getMonth());
System.out.println("Day : " + mybd.getDay());
System.exit(0);
}
}