Skip to content
Sharp

Modern Java · interview question

When should you usually prefer a traditional class over a Record?

Multiple choiceMediumchapter-12-curatedpremiummodern-javajava-records
Choose one answer
Answer and explanation

Correct answer

A. When the type needs mutable state or richer lifecycle behavior

Why

A behavior-rich aggregate or mutable model often needs a normal class. Records are optimized for concise data representation, not for every kind of evolving object state.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →