什么code和如何java.lang.reflect.Array中在运行时创建一个新的数组? [英] What code and how does java.lang.reflect.Array create a new array at runtime?

查看:185
本文介绍了什么code和如何java.lang.reflect.Array中在运行时创建一个新的数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看着Java源$ C ​​$ c和方法类似于如下:

I looked into Java source code and the method is like follows:

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;

看来它没有任何code的方法 newArray()来创建数组。任何人都可以解释它是如何建立一个数组? ŧ

It seems it does not have any code in the method newArray() to build an array. Can anyone explain how it builds an array? T

推荐答案

这是一个本地方法。

这意味着它是由JRE中的原生code语言实现的。

That means it's implemented by native code within the JRE.

这篇关于什么code和如何java.lang.reflect.Array中在运行时创建一个新的数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆