一、Integer.TYPE :(int.class)
返回的是 int (Class<?>)
而
二、Integer.class:
返回是的 Integer 类的对象。1、我怎么都越想越是觉得都是一样的哈···
2、我下面新建一个 3维 数组:
int[] dim = new int[] { 5, 10, 15 };
// array 是 3维数组.
Object array = Array.newInstance(Integer.TYPE, dim);
//componentType - the Class object representing the component type of the new array
按照JDK 说的
我总感觉应该用 Integer.class
因为我的输出:
System.out.println(Integer.TYPE); -> outPut:int
System.out.println(Integer.class); -> outPut:class java.lang.Intege //不是这个才是对象么?
好乱哈,求助 CSDN 的好心人
Integer[] array1 = (Integer[])Array.newInstance(Integer.class, 3);这样写能明白不