Skip to content
Sharp

Object-oriented programming · interview question

In the context of Java, what does it mean for a class to be immutable?

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

Correct answer

A. Its instances cannot change state after instantiation.

Why

An immutable class is one whose instances cannot change their state once constructed. This ensures consistent behavior and thread safety.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →