Skip to content
Sharp

Object-oriented programming · interview question

Which Java keyword is used to ensure a class's field cannot be modified after initialization?

Multiple choiceEasychapter-3-curatedpremiumoopdefensive-copying
Choose one answer
Answer and explanation

Correct answer

C. Final

Why

The 'final' keyword in Java is used to declare constants or to prevent a field from being modified after it has been assigned a value.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →