Interviewer: What is encapsulation and how do you achieve it in Java?
Me: Encapsulation is a mechanism to hide
In the class, attributes and behaviors are placed together. An encapsulation means, that when you create a class, this itself means that you realize encapsulation principle. Because data and behaviors are encapsulated into the class. So data hiding is a major part of the term - encapsulation. And this means access points of the object.