Create an Array: An array of 10 int-arrays in Java

Description

The following code shows how to create an Array: An array of 10 int-arrays.

Example


//  w w w . j a  v  a 2  s . co m
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, 10);
    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