+ 5
Static Binding: The binding which can be resolved at compile time by compiler is known as static or early binding. Binding of all the static, private and final methods is done at compile-time . Why binding of static, final and private methods is always a static binding? Static binding is better performance wise (no extra overhead is required). 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: In Dynamic binding compiler doesn’t decide the method to be called. Overriding is a perfect example of dynamic binding. In overriding both parent and child classes have same method . for more: https://www.geeksforgeeks.org/static-vs-dynamic-binding-in-java/ https://www.javatpoint.com/static-binding-and-dynamic-binding
28th Mar 2018, 12:58 PM
Baraa AB
Baraa AB - avatar