java polymorphism run time or compile time code example

Example: run time polymorphism in java

Runtime polymorphism is a process of which take
cares the overriding method at run time
rather than compile time.
 In method overriding,
a subclass overrides a method with the same 
signature as that of in its superclass. 
During compile time, the check is made 
on the reference type. But, in the runtime,
JVM figures out the object type and would 
run the method that belongs to
that particular object.

Tags:

Java Example