JavaGian java tutorial and java interview question and answer

JavaGian , Free Online Tutorials, JavaGian provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.

Showing posts with label early (static) binding. Show all posts
Showing posts with label early (static) binding. Show all posts

Difference between early (static) binding vs late (dynamic) binding in Java

4:24 AM
In  order to understand the difference between static and dynamic binding in Java, it's important to first learn what is binding? Binding means the link between reference and actual code e.g. when you refer a variable it's bonded to the code where it is defined, similarly when you call a method, it's linked to the code where a method is defined. There are two types of method binding in Java, static binding and dynamic binding. When a method is called in Java it's bonded to the actual code either at compile time or runtime, when the program is actually started and objects are created. As the name suggest, static binding is more of static nature hence it occurs at compile time i.e. your code knows which method to call once you compiled your Java source file into a class file. Since it happens early in program's life cycle it is also known as early binding in Java. On the other hand, dynamic binding occurs at runtime, when JVM starts your program. This time which me

.