This way data can only be accessed by public methods thus making the private fields and their implementation hidden for outside classes. That’s why encapsulation is known asdata hiding.Lets see an example to understand this concept better. Key Concepts of Encapsulation in Java: Private Variables...
Encapsulation is one of the four key concepts in OOPS (Object Oriented Programming) namelyInheritance, Encapsulation,Abstractionand Polymorphism. Following definition helps you to understand the concept of encapsulation: Encapsulation is a process of hiding the data from the users or in other words we ...