Given the code fragment:
LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);
LocalDate next15days = valentinesDay.plusDays (15);
LocalDate nextYear = next15days.plusYears(1); // line n1
System.out.println(nextYear);
What is the result?
Given the code fragment:
LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);
LocalDate next15days = valentinesDay.plusDays (15);
LocalDate nextYear = next15days.plusYears(1); // line n1
System.out.println(nextYear);
What is the result?
Given the code presents no syntax errors and performs a series of date manipulations, it starts by setting 'valentinesDay' to February 14, 2015. Adding 15 days to this date moves it to March 1, 2015. Subsequently, adding one year changes the date to March 1, 2016. Therefore, the correct result is 2016-03-01.
Answer is A -tested
Answer is A. Tested
A is the correct answer
A is correct.
A is the answer. Reason: 2015-02-14 + 15 days -> 2015-03-01 + 1 year -> 2016-03-01. 2015 is not a leaf year then FEB only 28 days