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"};
System.out.println(a1.getClass() == a2.getClass());//true
//System.out.println(a1.getClass() == a4.getClass());//编译失败 为什么?
//System.out.println(a1.getClass() ==a3.getClass());//编译失败
System.out.println(a1.getClass().getName());//[I 表示该java类是 一维数组,元素类型是int
System.out.println(a1.getClass().getSuperclass().getName());//java.lang.Object
System.out.println(a4.getClass().getSuperclass().getName());
Object aObj1 = a1;
Object aOvj2 = a4;
//Object[] aObj3 = a1;//编译失败,这个为什么啊?
Object[] aObj4 = a3;
Object[] aObj5 = a4;
求解释解释
|