How does a class enforce data hiding abstraction and encapsulation

In this topic, you will learn about, How does a class enforce data hiding abstraction and encapsulation.

In java language class is an important feature supported by oops where class directly or indirectly support data hiding, data abstraction, and data encapsulation features from oops.

  1. Data encapsulation: the creation of a class called data abstraction feature. data encapsulation offers the facility to create a container in which we can store a collection of data member and member function. due to encapsulation, we cant access these members outside of the class .so, we can also say that encapsulation implements data hiding concepts.
  2. Data hiding: It implements automatically with data encapsulation but we can also specify a public, private, and protected keyword for hiding where the public, private, and protected keyword specify properties for class members like a public member of the class can be accessed by using object at any position. a private member of the class only accessible by the same class public member and protected members access by using a private member of the class.
  3. Data abstraction: Data abstraction feature allows to create of a class object, due to abstraction we can specify state and behavior for an object. abstraction also implement by class initialize state and behavior for an object according to the class member.

    Comment below if you have queries related to the above topic, How does a class enforce data hiding abstraction and encapsulation.

See also  Difference between AWT and Swing