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 syntax of single inheritance in Java?

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  Borsada Tahtacılar kimdir?

Leave a Reply

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