Skip to content
Sharp

Modern Java · interview question

Which of the following scenarios is most appropriate for using a Java record?

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

Correct answer

C. A simple data carrier with immutable fields.

Why

Records are best used for simple data carriers with immutable fields, where the primary purpose is to hold data rather than complex behavior.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →