Skip to content
Sharp

Object-oriented programming · interview question

In Java, which of the following best describes the concept of encapsulation?

Multiple choiceEasychapter-3-curatedpremiumoopcontrolled-mutation
Choose one answer
Answer and explanation

Correct answer

A. Encapsulation is about hiding the implementation details and exposing only the necessary parts.

Why

Encapsulation involves keeping the details of an object's implementation hidden from the outside world, exposing only the necessary components through a well-defined interface.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →