Create A 10x20 2-dimensional int array in Java

Description

The following code shows how to create A 10x20 2-dimensional int array.

Example


/*from  ww  w.j  av  a2  s  .  c  om*/
import java.lang.reflect.Array;
import java.util.Arrays;
public class Main {
  public static void main(String[] argv) throws Exception {
    int[][] ints2 = (int[][]) Array.newInstance(int.class, new int[] { 10, 20 });
    System.out.println(Arrays.toString(ints2));
    
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Reflection »




Annotation
Array
Class
Constructor
Field
Generics
Interface
Method
Modifier
Package
Proxy