Multiple Choice Question

Quiz Guidelines



Consider the contents of following two files:


package a;
public class A{
A(){ }
public void print(){ System.out.println("A"); }
}           //File
package b;
import a.*;
public class B extends A{
B(){ }
public void print(){ System.out.println("B"); }
public static void main(String[] args){
new B();

What will be printed when you try to compile and run class B?

Select 1 option

A. It will print A.
B. It will print B.
C. It will not compile.
D. It will compile but will not run.
E. None of the above.

Q&A Set: