lunedì 1 aprile 2013

Q107

class X {
       static void m(int[] i) {
             i[0] += 7;
       }
 
       public static void main(String[] args) {
             int[] j = new int[1];
             j[0] = 12;
             m(j);
             System.out.println(j[0]);
       }
}
What is the result?
A.
7
B.
12
C.
19
D.
Compilation fails.
E.
An exception is thrown at run time
Rispota C: 19

Nessun commento:

Posta un commento