int [] a1 = new int[]{1,2,3};
int [] a2 = new int[4];
int[][] a3 = new int[2][3];
String [] a4 = new String[]{"a","b","c"};
Object aObj1 = a1; //正确,因为Int数组是Object
Object aObj2 = a4;
//Object[] aObj3 = a1; 错误,因为基本类型Int不是Object
Object[] aObj4 = a3; //正确,因为Int数组是Object
Object[] aObj5 = a4;
为什么a4既可以赋值给object,有可以赋值给object数组,但是int就不行
喵喔喔
相关分类