Check Incorrect date?
Hi, I've got written this code with some help of Sun's tutorial. But I still cannot find out why this program doesn't throw any exception when I try to enter an invalid date. What can I change so that 30/2/2004 (February 30th 2004) is incorrect?
public class Testje {
public static void main(String[] args){
Date trythis = new Date();
String test = args[0];
System.out.println("Print of the test string: " +test);
SimpleDateFormat formatter= new SimpleDateFormat ("dd/MM/yyyy");
try {
trythis = formatter.parse(test);
} catch (ParseException e) {
System.out.println("Wrong date");
e.printStackTrace();
}
String dateOut;
dateOut = formatter.format(trythis);
System.out.println(dateOut);
}
}
Thank you

