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.

All 2 Replies

here you are trying to store a one dimensional array of ints as single int.

ia2[0] = (int[])o;
here, ia2 is just one array, the one that is found

ia2 is a two dimensional array
ia2[0] is the first element of this two-dimensional array, being an one dimensional array itself
ia2[0][0] is the first element of the previous found one dimensional array, and is just a single int, not an array