Multiple Choice Question

Quiz Guidelines

 

QID: 
139
Question: 

What will be the output when the following class is compiled and run?

class ScopeTest{
static int x = 5;
public static void main(String[] args){
int x = ( x=3 ) * 4; // 1
System.out.println(x);
}
}

Select 1 option

A. It will not compile because line //1 cannot be parsed correctly.
B. It will not compile because x is used before initialization.
C. It will not compile because there is an ambiguous reference to x.
D. It will print 12.
E. It will print 3.

Q&A Set: 

Search the Web

Custom Search

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