I got this question from the bonus exam of K&B.
5. Given the following,
1. public class
Test {
2. public static void main(
String [] args) {
3. long [] [] a1;
4. long [] a2 [];
5. a2 = new long[3][];
6. a1 = a2;
7. System.out.println(a1[1][0]);
8. }
9. }
what is the result? (Choose one.)
A. 0
B. null
C. Compilation error at line 5
D. Compilation error at line 6
E. Compilation error at line 7
F. An exception is thrown at runtime
Why B is not the correct answer? Will the answer be B if we replace the line 5 with
a2 = new long[3][3];
Thanks in advance.