70 Run time Polymorphism | Dynamic Binding | Late/Lazy Binding

Code :


class A
{
void m1()
{
System.out.println("  super class m1() ");
}
}

class B extends A
{
void m1()
{
System.out.println("  sub class m1() ");
}
}


class  Test
{

public static void main( String args[] )
{
A obj = new B();
obj.m1();
}

}


Output:

Runtime polymorphism


Previous
Next Post »