KnowledgeBoat Logo
|

Computer Applications

Which of the following access specifiers will make a member accessible only within its own class?

  1. public
  2. private
  3. protected
  4. default

Encapsulation & Inheritance in Java

5 Likes

Answer

private

Reason — In Java, the private access specifier restricts a member’s visibility so it can be accessed only within the same class where it is declared.

Answered By

2 Likes


Related Questions