Multiple Choice Question

Quiz Guidelines

 

QID: 
36
Validated against: 
java8
Question: 

Consider the following code:

class Super { static String ID = "SUPER"; }

class Sub extends Super{

static { System.out.print("In Sub"); }

}

public class Test{

public static void main(String[] args){

System.out.println(Sub.ID);

}

}

What will be the output when class Test is run?

 

Select 1 option

A. It will print In Sub and SUPER.

B. It will print SUPER.

C. Depends on the implementation of JVM.

D. It will not even compile.

E. None of the above.

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!