filmov
tv
Explain java polymorphism java interview question interviewdot

Показать описание
Explain Java polymorphism methods ?
Polymorphic method invocations apply only to instance methods.
Shape Square
Circle
Rectangle
Shape circle = new Circle();
circle.Draw(); //circles Draw() method will be called.
You can always refer to an object with a more general reference variable type (a superclass
or interface), but at runtime, the ONLY things that are dynamically selected
based on the actual object (rather than the reference type) are instance methods.
Not static methods. Not variables. Only overridden instance methods are dynamically invoked based on the real object's type.
A Job Portal
Other Top Job Portals
Are you looking for a new Job ?