Skip to content
Sharp

Object-oriented programming · interview question

Why does encapsulation in object-oriented programming matter in practice?

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

Correct answer

B. To protect object state

Why

Encapsulation is primarily about protecting an object's state by restricting direct access to its fields. This allows the object to enforce rules and maintain consistency through controlled interfaces.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →