本帖最后由 杨政 于 2012-9-29 10:28 编辑
String[][] s2 = new String[][]{new String[]{"a","b"},new String[]{"c","d"}};
Object[] obj2 = s2;
Object[]是一个Object类型的一维数组,而里面Object类型的数组元素又是一维数组,这样Object[]既是一个Object类型的一维数组,也是一个String类型的二维数组了。所以才有Object[] obj2 = s2;
String[][] s2 = new String[][]{new String[]{"a","b"},new String[]{"c","d"}};
Object[] obj2 = s2;
可以理解为
String[] s1 = new String[]{"a","b"};
String[] s2 = new String[]{"c","d"};
Object obj1= s1;
Object obj2 = s2;
Object[] obje = new Object[]{obj1,obj2}; |