I'm not sure I understand your question - I'm inclined to answer "because it was programmed to", but I guess that's not what you want to hear. So please elaborate...
There is something called dynamic dispatcher in the JVM. In computer science, dynamic dispatch is the process of mapping a message to a specific sequence of code (method) at runtime. This is done to support the cases where the appropriate method cannot be determined at compile-time (i.e. statically). Dynamic dispatch is only used for code invocation and not for other binding processes (such as for global variables) and the name is normally only used to describe a language feature where a runtime decision is required to determine which code to invoke.
Further java uses pointers to adopt dynamic dispatcher. Each instance will have pointer to the methods and JVM maintains a table to map the objects and the methods
I'm pretty sure this is right ... somebody jump in if not ... restating roughly what Durgaprasad said ...
In pure dynamic, when you invoke a method on an object instance the runtime has to see if the class of that instance has the method. If not, the runtime has to walk up the inheritance stack and see if some ancestor class has the method. This is common in plenty of languages, very dynamic but relatively expensive. If you can keep all your classes in physical memory for minimal paging it's not too bad.
In Java the runtime goes to the class of the instance and the class has a direct connection to the code that will execute. That connection is built at compile time so there's no exploration of the inheritance stack. It's still runtime polymorphism because the compiler can't hook the caller up to the method because the compiler has no idea what the target object's class will be at runtime.
Post by:autobot
Paper beats rock. Scissors beats tiny ad.
a bit of art, as a gift, that will fit in a stocking