Wednesday, 2 July 2014

What is the static polymorphism and Dynamic polymorphism?

   Static polymorphism is the polymorphism exhibited at compile time. Here java compiler knows which
method is called. Method overloading and method overriding using static methods and method overriding using private or final methods are examples for static polymorphism.
   
    Dynamic polymorphism is  the polymorphism exhibited at runtime. Here java compiler does not understand which method is called at compile time. Only JVM decides which method is called at runtime. Method overloading and method overriding using instace methods are examples for Dynamic polymorphism.

No comments:

Post a Comment