What is Dynamic Binding in Java?


We all would have heard about Dynamic binding which is one of the key features of Java. But very few knows what that exactly means. Let us see what dynamic binding means with the help of small example.

Dynamic binding is one of the distinguishing properties of Java. Instead of explaining the concept by usual definitions, let us try to figure out dynamic binding in Java practically.

Let us consider there is a java program named sample.java which contains three classes in it. 1. the main class named sample 2. a class named add 3. a class named sub.

So we try to compile the program with java compiler. Now, notice there are 3 .class files created in your current working directory. Namely

1. sample.class
2. add.class
3. sub.class

Why is this happening? We compiled a single java program but javac creates three .class files. The reason behind this is Dynamic Binding. The bytecodes(class files) are loaded and executed only at the run time and only when there is a necessity of the particular class. But in the case of c language hich does not support the dynamic binding concept, loads the entire code to execute no matter the particular piece of code is needed for the execution or not.

Also you cannot run the program without any one of the classes. For instance consider you deleted the add.class from the directory. And try to run the program and it will shows an error saying a supporting class is missing.


Related Articles

Creating new JEE 5 applications (Java and EJB Web Services) using RAD 7.5

Now days, most of the enterprise applications are developed in RAD 7.0+ (Rational Application Developer). The Web service application can be written in Java or in EJB. For creating Web services in Java or EJB, the vast documentation is available. Referring such documentation during speedy development period becomes a hectic job. So to avoid it, this article will help to easily develop a JEE5 application using simple steps.

Program for Addition performer in Java

This article provides a description to the addition performer in Java, that can perform addition operation on two input numbers. Code for the addition performer is provided in the article. The program is based on use of Swings. In Java Frames can be created and different text fields alongwith labels corresponding to them can be added. And use of all these elements can develope an efficient adder.

What is difference between an Interface and Abstract class in Java?

Are you looking for an article which explains the concepts of an Interface and Abstract class in simple language? Then your search ends here. Read this article, herein the detail about abstract class and an Interface is given. Also the important differences between an Interface and Abstract class is in Java is explained. This article highlights the important aspects regarding whether abstract class to be used or an Interface is to be used for given requirement of Enterprise application.

Directory Structure - XML Output

In this article, I have submitted a Java program. We will be able to get the dynamic XML file with treeview represents a folder and file structure of a given folder path using it. This Java program also show how to use a recursive function to read a directory structure and then save it to XML file. I commented properly for your better understanding how the program flow goes. The output XML file is well-formed

More articles: Java

Comments



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: