Thursday, March 12, 2009

What are the different ways in which polymorphism can be achieved in

Question :What are the different ways in which polymorphism can be achieved in
java? (CoreJava)

Answer :Polymorphism can be acheived two ways
overloading - static binding/early binding
overriding - dynamic binding/late binding
In case of overloading the method to be called is decided at the compile
time based on the method signature.
In case of overriding the method to be called is decided at run time and
NOT at compile time. This is runtime polymorphism.

No comments: