Engineering Full Stack Apps with Java and JavaScript
What will be the result of attempting to compile and run the following class?
public class TestClass{ public static void main(String args[ ] ){ int i = 1; int[] iArr = {1}; incr(i) ; incr(iArr) ; System.out.println( "i = " + i + " iArr[0] = " + iArr [ 0 ] ) ; } public static void incr(int n ) { n++ ; } public static void incr(int[ ] n ) { n [ 0 ]++ ; } }
Select 1 option
A. The code will print i = 1 iArr[0] = 1;
B. The code will print i = 1 iArr[0] = 2;
C. The code will print i = 2 iArr[0] = 1;
D. The code will print i = 2 iArr[0] = 2;
E. The code will not compile.