Given the code fragment: What is the result?
A.
Null 4
B.
An IllegalArgumentException is thrown at run time
C.
4 Null
D.
4 An ArrayIndexOutOfBoundException is thrown at run time
Given the code fragment: What is the result?
A.
Null 4
B.
An IllegalArgumentException is thrown at run time
C.
4 Null
D.
4 An ArrayIndexOutOfBoundException is thrown at run time
This code does not compile, the code should be read :
System.out.println( array[4][1] );
System.out.println( array[1][4] );
before answering the question.
public static void main(String[] args) {
int [][] arr={{0},{0,1}, {0,2,4},{0,3,6,9},{0,4,8,12,16}};
System.out.println( arr[4][1] );
System.out.println( arr[1][4] );
}
it’s well for me
Perhaps Bob is talking about the extra parenthesis in the third line
First prints 4
System.out.println( array[4][1] );
second line
no extra parenthesis will be Exception
System.out.println( array[1][4] );
D