Encapsulation

Encapsulation


A class in Java is made of data variables (that hold data) and methods (that hold the logic for operations and perform operations on the data). This approach of combining an object's data with its methods is called encapsulation.


Java : Encapsulation Program List