I'm playing with Java to see how it works but I have some doubts about some kind of castings. Consider the following piece of code:
String[][] s = null;
Object[] o = null;
o = (Object[][]) s; // compile-time correct
Now, consider the following example:
Object[][] o = null;
String[] s = null;
s = (String[]) o; // compile-time error: Cannot cast from Object[] to String[]
Why does that happen? I'm confused.
Object[]toString[]. You're casting fromObject[][]toString[]Object[]is anObject(everything is anObject).Object[]is not necessarily one-dimensional. It could be any dimension you like. AnObject[][][][][]is anObject, so yourObject[]can contain severalObject[][][][][], making it six-dimensional.