Skip to content
Sharp

API Evolution · interview question

What does subtracting one month from March 31 using java.time.LocalDate evaluate to?

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

Correct answer

C. February 28 (or 29 in a leap year)

Why

Subtracting one month from March 31 navigates to the last valid day in February, which is either February 28 or 29, depending on whether it's a leap year.

Test yourself on API Evolution

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

Start free test
All API Evolution questions →