Advertisements
Advertisements
Question
The access specifier that gives visibility to the class only is ______.
Options
default
private
public
protected
MCQ
Fill in the Blanks
Advertisements
Solution
The access specifier that gives visibility to the class only is private.
Explanation:
The private access modifier provides the highest level of restriction in Java. When a variable, method, or constructor is declared as private, it is hidden from the rest of the application and can only be seen and accessed by code inside that exact same defining class.
shaalaa.com
Is there an error in this question or solution?
Chapter 6: Encapsulation - Exercises [Page 148]
