Skip to content
Sharp

Modern Java · interview question

What limitation of Java records might require consideration when modeling domain logic?

Multiple choiceHardchapter-7-curatedpremiummodern-javarecords
Choose one answer
Answer and explanation

Correct answer

C. Records cannot have additional instance fields beyond the defined components.

Why

Records are limited to the fields with which they are declared, known as components. You cannot add additional instance fields beyond these components, which might limit flexibility in complex domain modeling.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →