Pages

Jul 7, 2015

Static and Dynamic Binding in Java

Static Binding or Early Binding
The binding which can be resolved at compile time by compiler is known as static or early binding. All the static, private and final methods have always been bonded at compile-time . Why binding of Static, final and private methods is always a static binding? You would understand it better after reading dynamic binding. Still let me explain this – Compiler knows that all such methods cannot be overridden and will always be accessed by object of local class. Hence compiler doesn’t have any difficulty to determine object of class (local class for sure). That’s the reason binding for such methods is static.
Dynamic Binding or Late Binding
When compiler is not able to resolve the call/binding at compile time, such binding is known as Dynamic or late Binding.

Reference:
http://beginnersbook.com/2013/04/java-static-dynamic-binding/

No comments:

Post a Comment