Skip to content
Sharp

Language Upgrades · interview question

How would you explain a significant advantage of using the java.time API over the older Date and Calendar classes in an interview?

Multiple choiceEasychapter-12-curatedpremiumlanguage-upgradesmigration-strategy
Choose one answer
Answer and explanation

Correct answer

D. Immutable and thread-safe design

Why

The java.time API offers a modern, immutable, and thread-safe design, which prevents issues common with the mutable Date and Calendar classes, leading to more predictable and safer code in concurrent environments.

Test yourself on Language Upgrades

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

Start free test
All Language Upgrades questions →