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  How do you declare an inheritance in Java?

Leave a Reply

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