int [] ia1 = {1,2,3};
int [][] ia2;
Object o = ia1;
ia2 = new int [3][3];
ia2[0] = (int[])o;
ia2[0][0] = (int[])o;
Answer is "Compilation fails in last line"
Explanation: Arrays are objects, and that each array dimension is a separate type. So, for instance, ia2 is of type "two dimensional int array", which is a different type than ia1. Last line attempts to assign a one-dimensional array into an int.
Doubt: Isn't the second last line also trying to assign a one dimensional int array to a two dimensional one?
I'm terribly confused in the last two lines only. Rest I understood.
Thanks.