int[] x = {length};
Array.newInstance(componentType, x);
componentType the Class object representing the
component type of the new arraylength the length of the new arrayjava.lang.NullPointerException if the specified
componentType parameter is nulljava.lang.IllegalArgumentException if componentType is java.lang.Void.TYPEjava.lang.NegativeArraySizeException if the specified length
is negativecomponentType
represents a non-array class or interface, the new array
has dimensions.length dimensions and
componentType as its component type. If
componentType represents an array class, the
number of dimensions of the new array is equal to the sum
of dimensions.length and the number of
dimensions of componentType. In this case, the
component type of the new array is the component type of
componentType.
The number of dimensions of the new array must not exceed the number of array dimensions supported by the implementation (typically 255).
componentType the Class object representing the component
type of the new arraydimensions an array of int representing the dimensions of
the new arrayjava.lang.NullPointerException if the specified
componentType argument is nulljava.lang.IllegalArgumentException if the specified dimensions
argument is a zero-dimensional array, or if the number of
requested dimensions exceeds the limit on the number of array dimensions
supported by the implementation (typically 255), or if componentType
is java.lang.Void.TYPE.java.lang.NegativeArraySizeException if any of the components in
the specified dimensions argument is negative.int.
array the arrayjava.lang.IllegalArgumentException if the object argument is not
an arrayarray the arrayindex the indexjava.lang.NullPointerException If the specified object is nulljava.lang.IllegalArgumentException If the specified object is not
an arrayjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to the
length of the specified arrayboolean.
array the arrayindex the indexjava.lang.NullPointerException If the specified object is nulljava.lang.IllegalArgumentException If the specified object is not
an array, or if the indexed element cannot be converted to the
return type by an identity or widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to the
length of the specified arrayget(java.lang.Object,int)byte.
array the arrayindex the indexjava.lang.NullPointerException If the specified object is nulljava.lang.IllegalArgumentException If the specified object is not
an array, or if the indexed element cannot be converted to the
return type by an identity or widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to the
length of the specified arrayget(java.lang.Object,int)char.
array the arrayindex the indexjava.lang.NullPointerException If the specified object is nulljava.lang.IllegalArgumentException If the specified object is not
an array, or if the indexed element cannot be converted to the
return type by an identity or widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to the
length of the specified arrayget(java.lang.Object,int)short.
array the arrayindex the indexjava.lang.NullPointerException If the specified object is nulljava.lang.IllegalArgumentException If the specified object is not
an array, or if the indexed element cannot be converted to the
return type by an identity or widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to the
length of the specified arrayget(java.lang.Object,int)int.
array the arrayindex the indexjava.lang.NullPointerException If the specified object is nulljava.lang.IllegalArgumentException If the specified object is not
an array, or if the indexed element cannot be converted to the
return type by an identity or widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to the
length of the specified arrayget(java.lang.Object,int)long.
array the arrayindex the indexjava.lang.NullPointerException If the specified object is nulljava.lang.IllegalArgumentException If the specified object is not
an array, or if the indexed element cannot be converted to the
return type by an identity or widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to the
length of the specified arrayget(java.lang.Object,int)float.
array the arrayindex the indexjava.lang.NullPointerException If the specified object is nulljava.lang.IllegalArgumentException If the specified object is not
an array, or if the indexed element cannot be converted to the
return type by an identity or widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to the
length of the specified arrayget(java.lang.Object,int)double.
array the arrayindex the indexjava.lang.NullPointerException If the specified object is nulljava.lang.IllegalArgumentException If the specified object is not
an array, or if the indexed element cannot be converted to the
return type by an identity or widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to the
length of the specified arrayget(java.lang.Object,int)array the arrayindex the index into the arrayvalue the new value of the indexed componentjava.lang.NullPointerException If the specified object argument
is nulljava.lang.IllegalArgumentException If the specified object argument
is not an array, or if the array component type is primitive and
an unwrapping conversion failsjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to
the length of the specified arrayboolean value.
array the arrayindex the index into the arrayz the new value of the indexed componentjava.lang.NullPointerException If the specified object argument
is nulljava.lang.IllegalArgumentException If the specified object argument
is not an array, or if the specified value cannot be converted
to the underlying array's component type by an identity or a
primitive widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to
the length of the specified arrayset(java.lang.Object,int,java.lang.Object)byte value.
array the arrayindex the index into the arrayb the new value of the indexed componentjava.lang.NullPointerException If the specified object argument
is nulljava.lang.IllegalArgumentException If the specified object argument
is not an array, or if the specified value cannot be converted
to the underlying array's component type by an identity or a
primitive widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to
the length of the specified arrayset(java.lang.Object,int,java.lang.Object)char value.
array the arrayindex the index into the arrayc the new value of the indexed componentjava.lang.NullPointerException If the specified object argument
is nulljava.lang.IllegalArgumentException If the specified object argument
is not an array, or if the specified value cannot be converted
to the underlying array's component type by an identity or a
primitive widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to
the length of the specified arrayset(java.lang.Object,int,java.lang.Object)short value.
array the arrayindex the index into the arrays the new value of the indexed componentjava.lang.NullPointerException If the specified object argument
is nulljava.lang.IllegalArgumentException If the specified object argument
is not an array, or if the specified value cannot be converted
to the underlying array's component type by an identity or a
primitive widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to
the length of the specified arrayset(java.lang.Object,int,java.lang.Object)int value.
array the arrayindex the index into the arrayi the new value of the indexed componentjava.lang.NullPointerException If the specified object argument
is nulljava.lang.IllegalArgumentException If the specified object argument
is not an array, or if the specified value cannot be converted
to the underlying array's component type by an identity or a
primitive widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to
the length of the specified arrayset(java.lang.Object,int,java.lang.Object)long value.
array the arrayindex the index into the arrayl the new value of the indexed componentjava.lang.NullPointerException If the specified object argument
is nulljava.lang.IllegalArgumentException If the specified object argument
is not an array, or if the specified value cannot be converted
to the underlying array's component type by an identity or a
primitive widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to
the length of the specified arrayset(java.lang.Object,int,java.lang.Object)float value.
array the arrayindex the index into the arrayf the new value of the indexed componentjava.lang.NullPointerException If the specified object argument
is nulljava.lang.IllegalArgumentException If the specified object argument
is not an array, or if the specified value cannot be converted
to the underlying array's component type by an identity or a
primitive widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to
the length of the specified arrayset(java.lang.Object,int,java.lang.Object)double value.
array the arrayindex the index into the arrayd the new value of the indexed componentjava.lang.NullPointerException If the specified object argument
is nulljava.lang.IllegalArgumentException If the specified object argument
is not an array, or if the specified value cannot be converted
to the underlying array's component type by an identity or a
primitive widening conversionjava.lang.ArrayIndexOutOfBoundsException If the specified index
argument is negative, or if it is greater than or equal to
the length of the specified arrayset(java.lang.Object,int,java.lang.Object)