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  Aşırı tüketim sorunu nedir?

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  How do you buy linear coins?

Leave a Reply

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