Guided Notes
Inheritance & Polymorphism
extends and super, overriding methods, polymorphism, abstract classes, and inner classes.
Inheritance
Slide 1 / 5Inheritance lets a class reuse another class's fields and methods:
class Vehicle { protected String brand = "Ford"; void honk() { System.out.println("Tuut!"); } } class Car extends Vehicle { String model = "Mustang"; }
Car is the subclass (child); Vehicle is the superclass (parent). A Car has brand, model, and honk().
Java allows only one superclass per class. Mark a class final to stop others extending it.
