Multiple choice technology

The use of protected keyword to a member in a class will restrict its visibility as follows

  1. Visible only inside the package

  2. Visible only in the class and its subclass in the same package

  3. Visible in all classes in the same package and subclasses in other packages

  4. Visible only in the class where it is declared

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Protected visibility in Java spans two scopes: (1) all classes within the same package (like default access), plus (2) subclasses in other packages. This makes protected broader than package-private but narrower than public.