28. What is the result of trying to compile and run
the following program?
class Base
{
public static void doIt()
{
System.out.println("Base doit");
}
}
class Sub extends Base
{
public static void doIt()
{
System.out.println("Sub doit");
}
}
class bstest
{
public static void main(String []p)
{
Base b = new Sub();
b.doIt();
}
}
Select 1 correct answer:
A. Compiles and runs printing "Sub doit"
B. Compiles and runs printing "Base doit"
C. The program fails to compile
D. None of the above