Skip to content
Sharp

Modern Java · interview question

Which feature is automatically provided by Java records?

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

Correct answer

A. A canonical constructor

Why

Java records automatically provide a canonical constructor that initializes the record's fields based on its declared components. This constructor is provided unless you define a custom one.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →