Bird
0
0

Why does Java allow method overriding but not multiple inheritance of classes?

hard📝 Conceptual Q10 of 15
Java - Inheritance

Why does Java allow method overriding but not multiple inheritance of classes?

ATo force programmers to write more code
BTo avoid ambiguity and complexity in method resolution
CBecause overriding is easier to implement than inheritance
DBecause Java does not support inheritance at all
Step-by-Step Solution
Solution:
  1. Step 1: Understand method overriding and multiple inheritance

    Overriding allows child to provide specific behavior; multiple inheritance can cause conflicts.
  2. Step 2: Identify reason for Java design choice

    Java avoids multiple inheritance to prevent ambiguity in which parent method to use.
  3. Final Answer:

    To avoid ambiguity and complexity in method resolution -> Option B
  4. Quick Check:

    Java avoids multiple inheritance to prevent ambiguity [OK]
Quick Trick: Avoid ambiguity: Java allows overriding but not multiple class inheritance [OK]
Common Mistakes:
  • Thinking Java does not support inheritance
  • Believing overriding is easier than inheritance
  • Assuming design is to force more code

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes