Compile time binding – JAVA

When we have different methods in super and derived class, it is very much clear at the time of compilation that which method are to be invoked or executed as the binding gets completed at the compilation time.

e.g:

//program to show concept of compile time binding

class Base

{

public void showBase()

{

System.out.println(“show of class Base”);

}

}

class Derived

{

public void showDerived()

{

System.out.println(“show of class Derived”);

}

public static void main(String args[])

{

Derived ob=new Derived();

ob.showDerived();

}

}

Leave a Reply

Your email address will not be published. Required fields are marked *