Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 183

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?

    Correct Answer: A

    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.

Discussion
Abdullah_RahahleahOption: A

Answer is A -tested

jduarteOption: A

Answer is A. Tested

asdfjhfgjuaDCVOption: A

A is the correct answer

steefaandOption: A

A is correct.

duydnOption: A

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