What is the output of the following?
LocalDate xmas = LocalDate.of(2016, 12, 25); xmas.plusDays(-1); System.out.println(xmas.getDayOfMonth());
B.
Java 8 date and time classes are immutable.
The plusDays()
method returns a LocalDate object presenting Christmas Eve (December 24th).
This return value is ignored.
The xmas variable still represents the original value, so Option B is correct.