2D Array Initialization Type Mismatch
What kind of error will this code produce?
public class Arr2D{
private int [][] arr;
Arr2D( int rows, int columns){
arr = new String[rows][columns];
}
}
A
ArrayIndexOutOfBoundsException during execution.
B
Runtime error because the array is not initialized properly.
C
No error; the code compiles and runs as intended.
D
Compilation error due to type mismatch: cannot convert String[][] to int[][].
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #2 | psak12 | 1 | 1 | 0m 26s | 74 |
| #3 | y.seong2027 | 2 | 2 | 2m 35s | 45 |
| #4 | dobaonam8386 | 1 | 2 | 0m 58s | 32 |
| #5 | singhris000 | 1 | 1 | 1m 16s | 24 |
| #6 | ponneban000 | 1 | 2 | 1m 27s | 3 |
| #7 | mullameh001 | 3 | 4 | 7m 30s | -160 |
| #8 | ajcantuwilson0325 | 1 | 1 | 16m 54s | -914 |
| #9 | geethasailaja | 1 | 2 | 20m 57s | -1,167 |
APFIVE