Given the code fragment:
LocalDate javaBirthday = LocalDate.of(1995, Month.MAY, 23); LocalDate twentiethAnniversary = javaBirthday.plusYears(20); twentiethAnniversary.plusDays(1); //line n1 System.out.println(twentiethAnniversary);
What is the result?
B. A DateTimeException is thrown
D. A compilation error occurs at line n1
The correct answer is A.
Strange as it is, but a very similar question was also on the OCA exam. All you have to do is recall that every LDT-related class is immutable.