Alok
Answered On : Oct 27th, 2005
A a1 = new b();
a1.display();
Login to rate this answer.
Devidas
Answered On : Nov 14th, 2005
A a1= new B(); a1.display();
Login to rate this answer.
abstract class A
{
void display()
{
}
}
class B extends A
{
void display()
{
super.display();
-----------------
}
public static void main(String args[])
{
B b1=new B();
b1.display();
}
}
Login to rate this answer.
all three answers above are correct. in 3rd one we are assigning object of B to reference of B itself. But in first and second answers we are assigning object of B to Reference of A. In all three cases JVM will invoke B's display() only.
Login to rate this answer.