Which two Java reserved words are used to implement encapsulation?
Which two Java reserved words are used to implement encapsulation?
In Java, encapsulation is implemented using access modifiers to control the visibility and accessibility of class members. The 'public' keyword allows methods and properties to be accessed from outside the class, enabling interaction with other classes. The 'private' keyword restricts access to methods and properties, ensuring that they can only be accessed within the same class. This combination of public and private access modifiers helps to protect and encapsulate the data within the class.
Encapsulation means to combine same properties in one class or method. which are initialised with Public and private
C and E are the correct answers. Encapsulation in Java is accomplished with public and private methods and properties.