Exam 1z0-811 All QuestionsBrowse all questions from this exam
Question 12

Which two Java reserved words are used to implement encapsulation?

    Correct Answer: C, E

    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.

Discussion
supercoderOptions: CE

Encapsulation means to combine same properties in one class or method. which are initialised with Public and private

tombatossalsOptions: CE

C and E are the correct answers. Encapsulation in Java is accomplished with public and private methods and properties.