Encapsulation in Java
Overview
Encapsulation is done when you declare the properties of a class with private access modifier. As these properties are private you can't access these properties outside a class, even with it objects. So if you want to access these properties, you have to use Getter and Setter methods. This is called encapsulation.
Comments
Post a Comment