Method overriding is a feature of Java where a subclass provides its own implementation of a method that is already defined in its parent class. The overridden method must have the same name, parameter list, and compatible return type as the method in the superclass. Method overriding enables runtime polymorphism, allowing Java to execute the appropriate method based on the actual object type.
A Vehicle class may define a start() method, but different vehicle types can provide their own implementation of how they start.
class Vehicle {
void start() {
System.out.println("Vehicle is starting");
}
}
class Car extends Vehicle {
@Override
void start() {
System.out.println("Car is starting with a key");
}
}
public class Demo {
public static void main(String[] args) {
Vehicle vehicle = new Car();
vehicle.start();
}
}Car is starting with a key
class Parent {
public void display() {
}
}
class Child extends Parent {
private void display() { // Compilation Error
}
}The child method has weaker access privileges, which is not allowed.
A concise interview answer is
Method overriding occurs when a subclass provides its own implementation of a method already defined in the parent class. The method must have the same name, parameters, and compatible return type. It is the foundation of runtime polymorphism in Java.
Last updated: 16 July 2026
Previous question: What are the rules for method overloading in Java?
Next question: How does the @Override annotation influence method overriding?