Skip to content
Sharp

API Evolution · interview question

How would you add 5 days to a java.time.LocalDate object?

Multiple choiceMediumchapter-12-curatedpremiumapi-evolutionmodern-date-and-time
Choose one answer
Answer and explanation

Correct answer

A. Date.plusDays(5)

Why

The plusDays(long daysToAdd) method adds the specified number of days to the LocalDate object, returning a new LocalDate instance with the days added.

Test yourself on API Evolution

A free test with instant, explained results. No account needed.

Start free test
All API Evolution questions →