我查看了Java源代码,方法如下:
public static Object newInstance(Class<?> componentType, int length)
throws NegativeArraySizeException {
return newArray(componentType, length);
}
private static native Object newArray(Class componentType, int length)
throws NegativeArraySizeException;
似乎
newArray()
方法中没有任何代码来构建数组。谁能解释它如何构建数组? Ť 最佳答案
这是native
方法。
这意味着它是通过JRE中的本机代码实现的。