How can a protected modifier be accessed?

Ngô Quốc Huy

New member
How can a protected modifier be accessed?
A. accessible only within the class
B. accessible only within package
C. accessible within package and outside the package but through inheritance only
D. accessible by all
 
Answer: c
Explanation: The protected access modifier is accessible within package and outside the package but only through inheritance. The protected access modifier can be used with data member, method and constructor. It cannot be applied in the class.
 

Tìm kiếm

Back
Top