Back to Lessons

Inheritance in Java Programming

April 5, 2026

Inheritance

Mechanism allowing child classes to inherit parent properties.

Inheritance Example

class Vehicle {
    void start() {
        System.out.println("Vehicle started");
    }
}

class Car extends Vehicle {
    void accelerate() {
        System.out.println("Car accelerating");
    }
}

Key Points

  • extends keyword establishes inheritance.
  • super calls parent constructor/method.
  • Single inheritance for classes (multiple via interfaces).
  • Child < parent in "is-a" relationship.