Encapsulation in Java

Encapsulation is the hiding of data and code from outside interference.The data and code can only be accessed/modified by the class in which it is defined. This is achieved by declaring the variables as private and getters/setters as public. Note: private and public are access specifiers about which we will talk a little later. The … Read more