Skip to content
Sharp

Language Upgrades · interview question

Why do teams use the java.time API over older date and time classes in production code?

Multiple choiceMediumchapter-12-curatedpremiumlanguage-upgradespattern-matching
Choose one answer
Answer and explanation

Correct answer

C. It provides immutable date and time objects.

Why

The primary benefit of using the java.time API is that it provides immutable date and time objects, reducing errors related to mutable state and improving the reliability of date-time operations in concurrent applications.

Test yourself on Language Upgrades

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

Start free test
All Language Upgrades questions →