Encapsulation in Java can be achieved by: Declaring the variables of a class as private. Providing public setter and getter methods to modify and view the variables values .
Encapsulation in Java can be achieved by: Declaring the variables of a class as private. Providing public setter and getter methods to modify and view the variables values .