Skip to content
Sharp

API Evolution · interview question

In a multithreaded e-commerce application, which class would be preferable for handling timestamps and why?

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

Correct answer

B. Instant, because it's immutable and thread-safe

Why

The Instant class is preferable in a multithreaded environment because it is immutable and thread-safe. This ensures that timestamps are consistent and safe to use across multiple threads.

Test yourself on API Evolution

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

Start free test
All API Evolution questions →