Difference Between static and dynamic binding in Java

Static Binding Dynamic Binding
Events occur at compile time Events occur at run time.
All information needed to call a function is known
at the compile time.
Static binding uses Type(Class in Java)
information for binding
All information need to call a function come to know at the run time.
Dynamic binding uses Object to resolve binding.
The advantage of static binding is Efficiency The advantage of dynamic binding is Flexibility.
Fast Execution Slow Execution.
Static binding is also called as Early Binding. Static binding is called as Late Binding.
  • Problem occurs,
    • Binding of a name
    • Activation of a procedure
    • Lifetime of a binding
  • Problem occurs,
    • Declaration of a name(variable, etc.)
    • Scope of the declaration.
Overloaded function call, Overloaded operators. Virtual function in C++, overridden methods in java.

Categorized in:

Tagged in:

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,