What is static and dynamic binding in Java ?
- The binding which can be determined at compile time by compiler is known as static binding.
- The binding of static, private and final methods is compile-time.
- The class is determined at the compile time only. So, method cannot be overridden.
- Object of local class to be accessed in static.
- When compiler is not able to determination the call/binding at compile time, such binding is known as Dynamic or late Binding.
- Method Overriding is the good example for dynamic binding.
- In overriding concept have the both parent and child classes should be presented they have same method and in this case the type of the object only determines which method is to be executed.
- At the run time is determined to the type of object. So, this is known as dynamic binding.