๐Ÿ“– Crammy ยท All study guides
AP Computer Science A ยท Unit 9

Inheritance: every key term you need

12 flashcard terms for AP Computer Science A Unit 9, written to match the course framework. Study them here, then drill them as interactive flashcards โ€” free, no account needed.

Study this unit free โ†’
Inheritance
Subclass extends superclass; inherits fields/methods. Code reuse, hierarchy. class Dog extends Animal { }
Superclass vs Subclass
Superclass (parent): general class (Animal). Subclass (child): specific class (Dog). Subclass IS-A superclass.
Method Overriding
Subclass redefines superclass method. Same name/signature, different implementation. Enables polymorphism.
Method Overloading
Same method name, different parameter types/number. Different from overriding; both can coexist.
super Keyword
Access superclass methods/constructors. super.method() calls parent's method. super() calls parent's constructor.
Constructors & Inheritance
Subclass constructor must call super() to initialize superclass fields. super() must be first statement.
Access Modifiers & Inheritance
private: subclass can't access. protected: subclass can access. public: all can access. default: package only.
Abstract Classes
abstract class: can't instantiate directly. Forces subclasses to implement abstract methods. abstract method has no body.
Abstract Methods
Method with no implementation in superclass; subclass must override. Ensures all subclasses implement required behavior.
Polymorphism
One interface, many forms. Animal a = new Dog(); a.sound(); calls Dog's method, not Animal's. Dynamic dispatch.
Object Class
All classes extend Object implicitly. Methods: toString(), equals(), getClass(). Can override toString() for meaningful output.
Unit 9 Summary
Inheritance creates class hierarchy. Subclass extends superclass, overrides methods. Polymorphism via interfaces/abstract classes.
Turn these into flashcards & quizzes โ†’

More AP Computer Science A guides