Skip to content
Sharp

Object-oriented programming · interview question

How would you explain a key reason for making a class immutable in a Java interview?

Multiple choiceMediumchapter-3-curatedpremiumoopobject-responsibility
Choose one answer
Answer and explanation

Correct answer

C. It simplifies thread safety

Why

An immutable class ensures that its instances cannot be modified after creation, which simplifies thread safety as no synchronization is needed when accessing its state.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →