What is inheritance in Java?

Inheritance is one of the core principles of Object-Oriented Programming (OOP) that allows a class to acquire the properties and behaviors of another class. It promotes code reusability and helps establish an "is-a" relationship between classes.

Key Points

Example

A Vehicle class can contain common properties such as speed and methods like start(). A Car class can inherit these features from Vehicle and also define its own specific functionality.

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

class Car extends Vehicle {
}

public class Main {
    public static void main(String[] args) {
        Car car = new Car();
        car.start();
    }
}

Interview Tip

A concise interview answer is

Inheritance is an OOP feature that allows one class to inherit the properties and methods of another class using the extends keyword. It promotes code reusability, establishes an is-a relationship, and helps create a hierarchical class structure.

Last updated: 16 July 2026

Previous question: What is object-oriented programming in Java?

Next question: What is polymorphism in Java?

More Core Java - Level I interview questions

All Core Java - Level I questions