SCJP5 - K&B
ch 6 - Pg 462...here is the code...
import java.util.*;
class Dates2 {
public static void main(
String[] args) {
Date d1 = new Date(1000000000000L);
System.out.println("1st date " + d1.toString());
Calendar c = Calendar.getInstance();
c.setTime(d1); // #1
if(c.SUNDAY == c.getFirstDayOfWeek()) // #2
System.out.println("Sunday is the first day of the week");
System.out.println("trillionth milli day of week is "
+ c.get(c.DAY_OF_WEEK)); // #3
c.add(Calendar.MONTH, 1); // #4
Date d2 = c.getTime(); // #5
System.out.println("new date " + d2.toString() );
}
}
and here is what the book says is the ouput
1st date Sat Sep 08 19:46:40 MDT 2001
Sunday is the first day of the week
trillionth milli day of week is 7
new date Mon Oct 08 20:46:40 MDT 2001 <-----should read 19:46:40
//only month has had one added to it ..