A method 'public static void modifyArray(int[] arr) { arr[0] = 99; }' is called with 'int[] myArray = {1,2,3}; modifyArray(myArray); System.out.println(myArray[0]);'. What is the output?
Trap 1: 1
The array is modified, so the value changes.
Trap 2: 0
Not the default value; the original element is overwritten.
Trap 3: Compilation error
The code compiles fine.
- A
99
The method modifies the array element.
- B
1
Why wrong: The array is modified, so the value changes.
- C
0
Why wrong: Not the default value; the original element is overwritten.
- D
Compilation error
Why wrong: The code compiles fine.