Skip to content
Sharp

Modern Java · interview question

In what scenario would using a record be inappropriate?

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

Correct answer

D. When the data structure requires mutability.

Why

Using a record is inappropriate when mutability is required, as records are designed to be immutable data carriers. For mutable objects, a regular class would be more suitable.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →