Array: newInstance(Class componentType, int... dimensions) : Array « java.lang.reflect « Java by API






Array: newInstance(Class componentType, int... dimensions)

 


import java.lang.reflect.Array;

public class Main {
  public static void main(String[] argv) throws Exception {
    int[][] ints2 = (int[][]) Array.newInstance(int.class, new int[] { 10, 20 });
  }
}

   
  








Related examples in the same category

1.Array: clone()
2.Array: get(Object array, int index)
3.Array: getInt(Object array, int index)
4.Array: getLength(Object array)
5.Array: newInstance(Class componentType, int length)
6.Array: set(Object array, int index, Object value)
7.Array: setInt(Object array, int index, int i)
8.Array: setLong(Object array, int index, long l)
9.Array: setShort(Object array, int index, short s)