Skip to content
Sharp

API Evolution · interview question

How does java.time.Instant ensure thread safety?

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

Correct answer

A. Instant is immutable.

Why

Instant is immutable, meaning its state cannot change after creation. This immutability ensures that it is inherently thread-safe as multiple threads cannot modify its state.

Test yourself on API Evolution

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

Start free test
All API Evolution questions →