Originally posted by Satish Kota:
How come this compiles
String[][] s=null;
Object[] o=s;
Even though it compiles why doesnt it generate runtime error as o and s are of different dimension.
It compiles and runs fine because it is valid... basically...
"s" is an array of an array of strings. Since arrays are also objects, an "array of strings" is also an object. Hence, "s" is also an array of objects.
Henry