A direct example from the Java Documentation :
public class Animal {
public static void testClassMethod() {
System.out.println("The class" + " method in Animal.");
}
public void testInstanceMethod() {
System.out.println("The instance " + " method in Animal.");
}
}
public class Cat extends Animal {
public static void testClassMethod() {
System.out.println("The class method" + " in Cat.");
}
public void testInstanceMethod() {
System.out.println("The instance method" + " in Cat.");
}
public static void main(String[] args) {
Cat myCat = new Cat();
Animal myAnimal = myCat;
Animal.testClassMethod();
myAnimal.testInstanceMethod();
}
}
The reason I used this example is, look at the scenario from your real-world situation. A Animal might have certain general features. But a Cat will have some features that are different from a generic Animal , but certain features that are an improvement over the generic Animal features. So, the Cat seems to override (will contain the overriding methods) the Animal features.
Another simple example if you are interested in cars. Say, there is a Car . It'll have an acceleration method. But a Ferrari will obviously have a better acceleration than a Car. But, a Ferrari is a Car. So, Ferrari overrides a method in Car. SO, overriding method is in subclass and the overriden method is in the base class.
So, do you get the point now? Overriding methods are present in the subclasses. But the methods that are overriden are present in the base class.