Skip to content
Sharp

Modern Java · interview question

When designing a domain model, why should you be cautious about using records for classes with business logic?

Multiple choiceHardchapter-7-curatedpremiummodern-javacleaner-domain-modeling
Choose one answer
Answer and explanation

Correct answer

B. Records are best suited for pure data holding without business logic.

Why

Records are intended for simple data carriers and do not suit classes where business logic is involved, as this can lead to confusing designs where data and behavior are not clearly separated.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →