Bird
0
0

In Java, which access modifier can be used in the overriding method if the original method is declared as protected?

easy📝 Conceptual Q2 of 15
Java - Polymorphism
In Java, which access modifier can be used in the overriding method if the original method is declared as protected?
Aprotected or public
Bdefault (package-private)
Cprivate
Dfinal
Step-by-Step Solution
Solution:
  1. Step 1: Recall access modifier rules in overriding

    The overriding method cannot reduce visibility. It can keep or increase it.
  2. Step 2: Apply to protected method

    Protected can be overridden by protected or public, but not private or default (which is less visible).
  3. Final Answer:

    protected or public -> Option A
  4. Quick Check:

    Overriding method visibility ≥ original method visibility = A [OK]
Quick Trick: Overriding method can't reduce visibility, can keep or increase it [OK]
Common Mistakes:
  • Using private or default which reduce visibility
  • Confusing final with access modifier
  • Assuming exact same modifier required

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes