The Reference variable's type not the object's type determines which method can be called and polymorphic method invocation apply only to overridden method. Thats why this code
runs eat() method of Horse.
As eat() method is an overridden method and
Polymorphism applies to overriding so object's type( here Horse) method runs.
Here the reference type is Animal which doesn't have buck() method so it will not compile. buck() is not an overridden method but an instance method of Horse. Calling of method is determined at compile time based on reference type