Interviewer: What is encapsulation and how do you achieve it in Java?
Me: Encapsulation is a mechanism to hide information from the client. The information may be data or implementation or algorithm. We achieve this using access modifiers.
Interviewer: This is data hiding. How do we achieve encapsulation in Java?
Me: uummmm
Конкретный вопрос:Помимо «модификаторов доступа», как реализовать инкапсуляцию в Java?