I'm a java newbie going through some training material, and this is one of the questions.
Given a valid DateFormat object df, and
Date d = new Date(0L);
String ds = "December 12, 2012";
//Insert correct code here
What updates d's value with date represented by ds?
A. d = df.parse(ds);
B. d = df.getDate(ds);
C. try{
d = df.parse(ds);
}
catch(ParseException e){ };
The correct answer is C. Why is that so? What is the difference between A and C?