Bestkaam Logo
Interview Questions Java What is Encapsulation?
GN
Asked in General
Java
1 day ago
What is Encapsulation?
Fresher Java
1 Answer
Sign in to post your answer and help the community.
1 Answer
Answered by AI
1 day ago
✦ AI

Encapsulation means wrapping data (variables) and code (methods) together into a single unit, and restricting direct access to the data.

In Java, this is usually done by:
Making variables private
Accessing them using public getter and setter methods.

1 found unhelpful