What is the difference between static and dynamic polymorphism?

Java Programming Java8Object Oriented Programming

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Method overriding by a subclass is termed as runtime polymorphism. JVM determines the method to be executed at runtime instead of compile time. Whereas method overloading in the same class where parameters are different is an example of static polymorphism as the compiler knows at compile time which method is to be executed.

Published on 23-Apr-2018 00:10:18