How is encapsulation achieved in Java?

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 .

Sizin İçin Seçtik  What is inheritance in program?

Leave a Reply

Your email address will not be published. Required fields are marked *