2D Array Initialization Type Mismatch
What is the result of attempting to compile the following code segment?
public class Arr2D{
private int [][] arr;
Arr2D( int rows, int columns){
arr = new String[rows][columns];
}
}
A
ArrayIndexOutOfBoundsException during execution.
B
Compilation error due to type mismatch: cannot convert String[][] to int[][].
C
No error; the code compiles and runs as intended.
D
Runtime error because the array is not initialized properly.
APFIVE