Interviewer: What is encapsulation and how do you achieve it in Java? Me: Encapsulation is a mechanism to hide
Interviewer: What is encapsulation and how do you achieve it in Java?
Me: Encapsulation is a mechanism to hide
The process of defining a class by hiding its data from direct access from the outside class member and providing the access only through publicly accessible setter and getter method through proper validation it is called Encapsulation.