Bird
0
0

What will happen if a subclass does not implement all abstract methods of its abstract superclass?

medium📝 Predict Output Q5 of 15
Java - Abstraction

What will happen if a subclass does not implement all abstract methods of its abstract superclass?

AThe program will run but throw runtime exceptions
BThe subclass will inherit default implementations automatically
CThe subclass must be declared abstract or it causes a compile-time error
DThe subclass can implement methods later at runtime
Step-by-Step Solution
Solution:
  1. Step 1: Recall rules for abstract methods in subclasses

    If a subclass does not implement all abstract methods, it must be abstract itself.
  2. Step 2: Understand consequences of not declaring abstract

    If not declared abstract, compiler error occurs.
  3. Final Answer:

    The subclass must be declared abstract or it causes a compile-time error -> Option C
  4. Quick Check:

    Unimplemented abstract methods require subclass to be abstract [OK]
Quick Trick: Unimplemented abstract methods force subclass to be abstract [OK]
Common Mistakes:
  • Assuming default implementations exist for abstract methods
  • Thinking runtime exceptions occur instead of compile errors
  • Believing methods can be implemented later dynamically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes