public static void main(String[] args) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
String dateStr = "35/35/1985";
Date date = sdf.parse(dateStr);
i was expecting run time exception like date parse exception but returned date object is Sat Dec 05 00:00:00 IST 1987
By what logic string 35/35/1985
parsed to date Sat Dec 05 00:00:00 IST 1987
?
update:- If I set the setLenient(false)
, it throws exception. But if I make it true
By what logic string 35/35/1985
parsed to date Sat Dec 05 00:00:00 IST 1987
?