Multiple choice

If there is a protected method within the Public class, then which of the following statements is correct?

  1. Protected method does not access the public method.

  2. Method is accessible from inside a class and a subclasses.

  3. Protected method is not allowed within the Public class.

  4. Method is accessible from inside the class and all the classes defined in the same package, where the class is defined itself.

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

Protected method is accessible from inside the class and all the classes defined in the same package, where the class is defined itself.