Skip to content
Sharp

API Evolution · interview question

Why is using java.time.LocalDate preferred over java.util.Date for representing a date without time?

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

Correct answer

A. LocalDate is immutable and time-zone agnostic.

Why

LocalDate is immutable and does not contain any time-of-day or time-zone information, making it suitable for representing a date without time, unlike java.util.Date which is mutable and includes time.

Test yourself on API Evolution

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

Start free test
All API Evolution questions →