If 'a' is a two dimension array (int[][]) then each element is a one dimension array (int[]).
So casting this way is not necessary; yes, just to confuse you. On your second question,
the compiler only knows 'o1' as an Object so it thinks the cast is okay. But at run time the
JVM knows that 'o1' is a 2-d array.
Jim Hoglund wrote:If 'a' is a two dimension array (int[][]) then each element is a one dimension array (int[]).
So casting this way is not necessary; yes, just to confuse you. On your second question,
the compiler only knows 'o1' as an Object so it thinks the cast is okay. But at run time the
JVM knows that 'o1' is a 2-d array.
Jim ... ...
Ok buddy thanks a lot for the solution, so even you are preparing for the SCJP exam (on your signature), same here buddy