Skip to content
Sharp

Object-oriented programming · interview question

Which of the following statements correctly defines a final field in a Java class?

Multiple choiceEasychapter-3-curatedpremiumoopimmutability-basics
Choose one answer
Answer and explanation

Correct answer

B. A field declared with the 'final' keyword cannot be modified once initialized.

Why

A field declared with 'final' cannot be changed once it is initialized. This is crucial for creating immutable classes.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →