Skip to content
Sharp

Modern Java · interview question

Why can using a Java record for representing a mutable user profile in an application become a problem in production code?

Multiple choiceMediumchapter-7-curatedpremiummodern-javamodern-java-design-choices
Choose one answer
Answer and explanation

Correct answer

B. Records are inherently immutable

Why

Java records are designed to be immutable data carriers. If you need mutable state, a traditional class would be more appropriate.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →