Multiple Choice Question

Quiz Guidelines

 

QID: 
368
Question: 

Consider the contents of following two files:

//File A.java

package a;
public class A{
A(){ }
public void print(){ System.out.println("A"); }
}           //File B.java
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: