Encapsulation simply means wrapping the data and code that works on the data together as a single unit. In java, data is nothing but variable and "code that works on data" is method. In encapsulation, the variables of given class will be hidden from any other classes, so that it can be accessed only through the methods of the current class. Therefore, it is also known as data hiding.
Encapsulation is one of the four fundamental OOPS Concept.
Now let's see how to implement encapsulation in Java.
Need Freelance Programming Writers, Contact us now at email@example.com