Why do we use Java encapsulation?

Answer: The major advantage of encapsulation in Java is data hiding . Using encapsulation we can allow the programmer to decide on the access to data and methods operating on that data. For example, if we want a particular piece of data to be inaccessible to anyone outside the class, then we make that data private.

Sizin İçin Seçtik  Encapsulation nedir ne ise yarar?

Leave a Reply

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

Why do we use Java encapsulation?

Answer: The major advantage of encapsulation in Java is data hiding . Using encapsulation we can allow the programmer to decide on the access to data and methods operating on that data. For example, if we want a particular piece of data to be inaccessible to anyone outside the class, then we make that data private.

Sizin İçin Seçtik  What is base class and child class in Java?

Leave a Reply

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