Given below the sample code :
1. Date dt = new Date();
2. String ds = ?December 21, 2009″;
3. // insert code here
4. try {
5. dt = datef.parse(ds);
6. }
7. catch(ParseException pe) {
8. System.out.println(?Unable to parse ? + ds);
9. }
10. // insert code here
Which code lines should add at line number 3 and 10 to add a day to the Date object?
1. 3. DateFormat datef = DateFormat.getDateFormat();
10. dt.setTime( (60 * 60 * 24) + dt.getTime());
2. 3. DateFormat datef = DateFormat.getDateInstance();
10. dt.setTime( (1000 * 60 * 60 * 24) + dt.getTime());
3. 3. DateFormat datef = DateFormat.getDateFormat();
10. dt.setLocalTime( (1000*60*60*24) + dt.getLocalTime());
4. 3. DateFormat datef = DateFormat.getDateInstance();
10. dt.setLocalTime( (60 * 60 * 24) + dt.getLocalTime());
(2)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.