Given the proper imports, and given:
24. Date d1 = new Date();
25. Date d2 = d1;
26. System.out.println(d1);
27. d2.setTime(d1.getTime() + (7 * 24 * 60 * 60));
28. System.out.println(d2);
Which are true? (Choose all that apply.)
C is correct.
When a Date is constructed with no arguments, the system's current time is used, not the Java "epoch.
" The code is correct, and the second date displayed is about 10 minutes after the first date because Date objects and setTime()
both use millisecond precision.
In order to add a week, we would have also had to multiply by 1000 in line 27.