Source: http://www.cnblogs.com/mengdd/archive/2012/12/25/2832288.html
The concept of polymorphism
polymorphic = = Late binding .
Do not interpret function overloading as polymorphic.
Because polymorphism is a run-time behavior, not a compile-time behavior.
Polymorphic: A reference to a parent type can point to an object of a subtype.
For example, Parent p = new Child ();
When calling a method using polymorphic mode, first check if there is a method in the parent class, and if not, compile the error;
If so, then call the subclass of the same name method.
(note here that static statics methods are special cases, static methods can only inherit, cannot override override, and if the subclass defines a static method with the same name, it only acts as a hidden effect on the parent class method.) The version of the call with whom the reference is made . )
(Refer to Learning Links: http://docs.oracle.com/javase/tutorial/java/IandI/override.html)
If you want to invoke a method in a subclass that is not in the parent class, you need to cast the coercion, as in the example above, convert p to a reference to subclass child type.
A method that does not exist in the parent class is not found when invoking the method with the parent class reference, because the parent class references the object to the child class. A downward type conversion is required to convert the parent class reference to a subclass reference.
Polymorphism in Java