Encapsulation:
The process of binding data and coding part is called as "Encapsulation".Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class.
it is also known as Data hiding or Information hiding
Or
Encapsulating data and corresponding method into a single module is called encapsulation.
It provides: Security
To achieve in Code:
1. Declare the variables of a class as private.
2.public setter and getter methods to modify and view the variables values.