Wednesday, September 20, 2006

Late Binding vs Early Binding

Often, an object type cannot be determined at compile time and must be dynamically resolved at runtime. This runtime resolution of object types is called late binding of instance methods and makes polymorphism possible in Java.

Late binding enables Java to choose the right version of a called method at runtime, depending on the type of object that is created.

The opposite of late binding is early binding. In early binding, variables and methods are resolved at compile time. Early binding doesn't support polymorphism, and is used in non-OO languages.

No comments: