Dynamic binding

Binding:
Association of method definition to the method call is known as binding.

Dynamic binding:

Method is not able to call appropiate defination at compile run.


  ABC{ public void mymethod()   {
       System.out.println("Class ABC: mymethod()");
   }    
}
class Test extends ABC{
   public void mymethod(){
      //This will call the mymethod() of parent class
      super.mymethod();
      System.out.println("Class Test: mymethod()");
   }
   public static void main( String args[]) {
      Test obj = new Test();
      obj.mymethod();
   }
}
In above During compile time association of method can't be determine while calling the 
method. Such Binding is called Dynamic binding.

0 comments:

Post a Comment

My Instagram