Let\'s take this simple Java code:
public class Animal {
public void eat() {
System.out.println(\"Generic Animal Eating Generically\");
}
}
public
This is called dynamic binding in Java. The explicite object type is used not the reference type.
It is not possible to call the overriden super method and the overriding method using a single method, see: How to call the overridden method of a superclass. You could add a method to your horse, which delegates the call to the animal like:
public class Horse extends Animal {
public void animalEat() {
super.eat();
}
public void eat() {
System.out.println("Horse eating hay ");
}
}