Practice mode Java

From where can a protected member of a Java class be accessed?

Correct answer B. Its own package, and subclasses in other packages

Explanation

Protected access includes everything package access allows, so any class in the same package may use the member. In addition, subclasses in other packages can access it, subject to a rule about the type of the reference used. It is therefore wider than package-private, not narrower, and non-subclass code elsewhere has no access.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.