In this question, i do understand how line //4 prints null, but the answer mentions that line //7 generates a run time error.
The array a3 has 3*3*3=27 number of elements. so in line //7 the array referenced by a2 is assigned to array assigned by a3[0], a3[1] and a3[2]. this is where i have the doubt, won't stmt //8 print the value null??
could someone clarify what the lines //6 through //8 mean?
Thanks in advance
class A13 {}
class A14 {
public static void main(
String[] arg) {
A13[] a1 = new A13[1]; // 1
A13[][] a2 = new A13[2][1]; // 2
A13[][][] a3 = new A13[3][3][3]; // 3
System.out.print(a3[2][2][2]); // 4
a1[0] = new A13(); // 5
a2[0] = a2[1] = a1; // 6
a3[0] = a3[1] = a3[2] = a2; // 7
System.out.print(a3[2][2][2]); // 8
}}
What is the result of attempting to compile and run the program?
a. Prints: null
b. Prints: nullnull
c. Compile-time error at 1.
d. Compile-time error at 2.
e. Compile-time error at 3.
f. Compile-time error at 4.
g. Compile-time error at 5.
h. Compile-time error at 6.
i. Compile-time error at 7.
j. Compile-time error at 8.
k. Run-time error