Java Array.newInstance(Class <?> componentType, int... dimensions)
Syntax
Array.newInstance(Class <?> componentType, int... dimensions) has the following syntax.
public static Object newInstance(Class <?> componentType,
int... dimensions)
throws IllegalArgumentException ,
NegativeArraySizeException
Example
In the following code shows how to use Array.newInstance(Class <?> componentType, int... dimensions) method.
import java.lang.reflect.Array;
/* w w w . j ava2s . c om*/
public class Main {
public static void main(String[] argv) throws Exception {
int[][] ints = (int[][]) Array.newInstance(int.class, 10,5);
}
}