15 June 2010

0 JAVA- A Comparison between Static Polymorphism and Dynamic Polymorphism

Static Polymorphism And Dynamic Polymorphism in JAVA

Static Polymorphism in JAVA is also known as Function Overloading in JAVA. Dynamic Polymorphism in JAVA is also known as Function Overriding in JAVA. Let us compare Function Overloading and Function Overriding in JAVA. Here it goes,the difference between Function Overloading and Function Overriding in JAVA

Static Polymorphism Dynamic Polymorphism
Function Overloading
– within same class more than one method having same name but differing in signature
Function Overriding
– keeping the signature and return type same, method in the base class is redefined in the derived class
Resolved during compilation time Resolved during run time
Return type is not part of method signature Which method to be invoked is decided by the object that the reference points to and not by the type of the reference


0 comments:

Feeds Comments

Please give your valuable comments.