Back-End/Java_1

[Java] Static Binding and Dynamic Binding

리딩리드 2016. 9. 8. 11:48

Static Binding and Dynamic Binding


1. Binding

- Connecting a method call to the method body is known ad binding


1) static binding(early binding)

2) dynamic binding(late binding)


2. Static binding

- When type of the object is determined at compiled time, is is known as static binding

- If there is any private, final or static method in class, there is static binding



3. Dynamic binding

- When type of the object is determined at run-time, it is known as dynamic binding

 

- Object type can't be determinded by the compiler, because the instance of Dog is also an instance of Animal, so Compiler doesn't know its type