Pages

Wednesday 27 November 2013

Difference between Static and dynamic polymorphism



Static Polymorphism 

Dynamic Polymorphism 

1. It is otherwise called as compiler-time polymorphism.

1.It is otherwise called as run-time polymorphism.
2. Overloading is used to achieve this.

2.Both overriding and dynamic dispatch is used to achieve this.

3. It is also called as static binding as compiler is binding the method with the object based on the argument.

3. It is called as dynamic binding as JVM will decide from which class the method will be executed based on the object assign.


4.Static method can be overloaded.

4. Static method never follow dynamic dispatch concept. 

5. All works are done at the compilation time by the compiler that's why called as static binding.

5. All works are done at the run-time by the JVM that's why called as dynamic binding.

6. It is achieved by the compiler at the compile time.

5. It is achieved by the JVM at the run-time.

No comments:

Post a Comment