模块 java.base

类 Array

java.lang.Object
java.lang.reflect.Array

public final class Array extends Object
Array 类提供动态创建和访问 Java 数组的静态方法。

Array 允许在 get 或 set 操作期间发生扩大转换,但如果发生缩小转换则抛出 IllegalArgumentException

自从:
1.1
  • 方法总结

    修饰符和类型
    方法
    描述
    static Object
    get(Object array, int index)
    返回指定数组对象中索引组件的值。
    static boolean
    getBoolean(Object array, int index)
    返回指定数组对象中索引组件的值,作为 boolean
    static byte
    getByte(Object array, int index)
    返回指定数组对象中索引组件的值,作为 byte
    static char
    getChar(Object array, int index)
    返回指定数组对象中索引组件的值,作为 char
    static double
    getDouble(Object array, int index)
    返回指定数组对象中索引组件的值,作为 double
    static float
    getFloat(Object array, int index)
    返回指定数组对象中索引组件的值,作为 float
    static int
    getInt(Object array, int index)
    返回指定数组对象中索引组件的值,作为 int
    static int
    getLength(Object array)
    返回指定数组对象的长度,作为 int
    static long
    getLong(Object array, int index)
    返回指定数组对象中索引组件的值,作为 long
    static short
    getShort(Object array, int index)
    返回指定数组对象中索引组件的值,作为 short
    static Object
    newInstance(Class<?> componentType, int length)
    创建具有指定组件类型和长度的新数组。
    static Object
    newInstance(Class<?> componentType, int... dimensions)
    创建具有指定组件类型和维度的新数组。
    static void
    set(Object array, int index, Object value)
    将指定数组对象的索引组件的值设置为指定的新值。
    static void
    setBoolean(Object array, int index, boolean z)
    将指定数组对象的索引组件的值设置为指定的boolean值。
    static void
    setByte(Object array, int index, byte b)
    将指定数组对象的索引组件的值设置为指定的byte值。
    static void
    setChar(Object array, int index, char c)
    将指定数组对象的索引组件的值设置为指定的 char 值。
    static void
    setDouble(Object array, int index, double d)
    将指定数组对象的索引组件的值设置为指定的double值。
    static void
    setFloat(Object array, int index, float f)
    将指定数组对象的索引组件的值设置为指定的float值。
    static void
    setInt(Object array, int index, int i)
    将指定数组对象的索引组件的值设置为指定的 int 值。
    static void
    setLong(Object array, int index, long l)
    将指定数组对象的索引组件的值设置为指定的long值。
    static void
    setShort(Object array, int index, short s)
    将指定数组对象的索引组件的值设置为指定的short值。

    在类 java.lang.Object 中声明的方法

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait