I am reading the SCJP book by Kathy Sierra. I find Polymorphism a little confusing.
Could you please help me out with a real world example for the following?
I understand that Polymorphism only works when you have overridden methods, no matter if you do it via class or interface, and at run-time the JVM determines the method based on the Object type.
Lets say Horse extends from Animal and it also overrides the eat() method. What is the benefit of doing: Animal a = new Horse(); a.eat(); over Horse b = new Horse();
b.eat();?
Eventually the result is going to be the same. I apologize its a very basic question but even all the senior developers in my team gave me all different answers.