definition of encapsulation in java
Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as as single unit.elow given is an example that demonstrates how to achieve Encapsulation in Java: The public setXXX() and getXXX() methods are the access points of the instance variables of the EncapTest class.