Bird
0
0

Why do we use inheritance in Java?

easy📝 Conceptual Q11 of 15
Java - Inheritance
Why do we use inheritance in Java?
ATo make programs run faster
BTo create unrelated classes
CTo reuse code from an existing class
DTo avoid using methods
Step-by-Step Solution
Solution:
  1. Step 1: Understand inheritance purpose

    Inheritance allows a new class to use code from an existing class, avoiding repetition.
  2. Step 2: Compare options

    Only To reuse code from an existing class correctly states code reuse. Others are incorrect because inheritance does not create unrelated classes, speed up programs directly, or avoid methods.
  3. Final Answer:

    To reuse code from an existing class -> Option C
  4. Quick Check:

    Inheritance = Code reuse [OK]
Quick Trick: Inheritance means reusing code from another class [OK]
Common Mistakes:
  • Thinking inheritance speeds up the program
  • Believing inheritance creates unrelated classes
  • Confusing inheritance with method removal

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes