Multiple choice technology programming languages

A method is declared as protected. What classes can access this method? (Choose two. Each option is a correct answer.)

    1. Classes in the same package
    1. All classes
    1. Only the class within the package that defined the method
    1. Classes that inherit access
Reveal answer Fill a bubble to check yourself
A,D Correct answer
Explanation

Protected access combines package-level and subclass access. Classes within the same package can access protected members, and subclasses (even in different packages) can also access them via inheritance. Unrelated classes in other packages cannot.