目录

java.lang.reflect - Array

介绍 (Introduction)

java.lang.reflect.Array类提供了动态创建和访问Java数组的静态方法。 Array允许在get或set操作期间扩展转换,但如果发生缩小转换,则抛出IllegalArgumentException。

类声明

以下是java.lang.reflect.Array类的声明 -

public final class Array
   extends Object

类方法

Sr.No. 方法和描述
1 static Object get(Object array,int index)

返回指定数组对象中索引组件的值。

2 static boolean getBoolean(Object array,int index)

返回指定数组对象中索引组件的值,作为布尔值。

3 static byte getByte(Object array,int index)

以字节形式返回指定数组对象中索引组件的值。

4 static char getChar(Object array,int index)

以char形式返回指定数组对象中索引组件的值。

5 static double getDouble(Object array,int index)

以double形式返回指定数组对象中索引组件的值。

6 static float getFloat(Object array,int index)

以float形式返回指定数组对象中索引组件的值。

7 static int getInt(Object array,int index)

以int形式返回指定数组对象中索引组件的值。

8 static int getLength(Object array)

以int形式返回指定数组对象的长度。

9 static long getLong(Object array,int index)

以long形式返回指定数组对象中索引组件的值。

10 static short getShort(Object array,int index)

返回指定数组对象中索引组件的值,作为short。

11 static Object newInstance(Class <?> componentType,int ... dimensions)

创建具有指定组件类型和尺寸的新数组。

12 static Object newInstance(Class <?> componentType,int length)

创建具有指定组件类型和长度的新数组。

13 static void set(Object array,int index,Object value)

将指定数组对象的索引组件的值设置为指定的新值。

14 static void setBoolean(Object array,int index,boolean z)

将指定数组对象的索引组件的值设置为指定的布尔值。

15 static void setByte(Object array,int index,byte b)

将指定数组对象的索引组件的值设置为指定的字节值。

16 static void setChar(Object array,int index,char c)

将指定数组对象的索引组件的值设置为指定的char值。

17 static void setDouble(Object array,int index,double d)

将指定数组对象的索引组件的值设置为指定的double值。

18 static void setFloat(Object array,int index,float f)

将指定数组对象的索引组件的值设置为指定的float值。

19 static void setInt(Object array,int index,int i)

将指定数组对象的索引组件的值设置为指定的int值。

20 static void setLong(Object array,int index,long l)

将指定数组对象的索引组件的值设置为指定的long值。

21 static void setShort(Object array,int index,short s)

将指定数组对象的索引组件的值设置为指定的short值。

方法继承

该类继承以下类中的方法 -

  • java.lang.Object
↑回到顶部↑
WIKI教程 @2018