Inheritance
AP Computer Science A · Unit 3: Classes
Inheritance notes
Fact-checked by a second, independent AI review.
Key ideas of inheritance in Java: how a subclass extends a superclass, overrides methods, and uses super to call superclass constructors or methods, with common exam questions to test understanding.
- extends / subclass / superclass
- Subclass uses extends to inherit fields and methods from the superclass (is-a relationship) and can add its own features.
- method overriding
- A subclass can provide a new implementation for a superclass method, using the same signature and optionally @Override for clarity.
- super() constructor
- A subclass constructor often calls super(...) to initialize the superclass part of the object.
- polymorphism and dynamic binding
- At runtime, the method version invoked is determined by the actual object type, not the reference type.
- common pitfalls
- Watch for overriding static methods (not polymorphic), forgetting to call super, and incorrect assumptions about field inheritance.
Remember it: Think: “extends = is-a;super = up one level; override = new behavior.”
Exam tip: Examiners look for correct use of extends, proper overriding with @Override, correct super(...) calls in constructors, and understanding dynamic binding vs. static methods.
Syllabus checklist
- Inheritance: core ideas
- Terms and typical exam questions for "Classes" in AP Computer Science A (Java
- College Board)
Practice questions
1. Which keyword indicates a class inherits from another in Java?
Answer checked
Show answer
Answer: extends. In Java, inheritance uses extends to derive a class from a superclass.
2. A subclass can override a method from its superclass.
Answer checked
Show answer
Answer: True. Method overriding is allowed in a subclass to provide a new implementation.
3. To call a superclass constructor from a subclass, use the ____ keyword.
Answer checked
Show answer
Answer: super(). super() must be used to invoke the superclass constructor.
4. If a subclass method has the same signature as a superclass method, it is called what?
Answer checked
Show answer
Answer: Overriding. Same signature in a subclass overrides the superclass method.
5. Enter the keyword that declares inheritance in Java.
Answer checked
Show answer
Answer: extends. The keyword is extends.

Practise inheritance as a game
Hearts, combos, streaks and an AI tutor that explains every answer. Start free.