Advertisements
Advertisements
Question
The access specifier that gives visibility to the package and to all the subclasses and the objects is ______.
Options
default
private
public
protected
MCQ
Fill in the Blanks
Advertisements
Solution
The access specifier that gives visibility to the package and to all the subclasses and the objects is protected.
Explanation:
The protected access modifier allows a class member (variable or method) to be accessed by any other class within the same package, as well as by any subclasses (inherited classes) even if they reside in completely different packages.
shaalaa.com
Is there an error in this question or solution?
Chapter 6: Encapsulation - Exercises [Page 148]
