GN
Asked in
General
Java
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
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