Multiple Choice Question

Quiz Guidelines

 

QID: 
439
Question: 

Given the following declarations:
        int a = 5, b = 7, k = 0;
        Integer m = null;
and the following statements:
        k = new Integer(a) + new Integer(b);  //1
        k = new Integer(a) + b; //2
        k = a + new Integer(b); //3
        m = new Integer(a) + new Integer(b); //4

Executed independent of each other, what will be the value of k (for //1, //2, and //3)
and m (for //4) after execution of each of these statements?

Select 1 option

A. 12    
will not compile
will not compile
12
B. will not compile
will not compile
will not compile
12
C. 12
12
12
D. will not compile
will not compile
will not compile
will not compile 
E. 12
12
12
will not compile

Q&A Set: