multi dimensional array in java definition code example
Example 1: Multidimensional array in java
import java.util.ArrayList;
import java.util.List;
public class Dynamic2dArray
{
public static void main(String[] args)
{
List<int[]> li = new ArrayList<>();
li.add(new int[]{2,4,6});
li.add(new int[]{3,5});
li.add(new int[]{1});
System.out.println("Element at [0][0]: " + li.get(0)[1]);
System.out.println("Element at [1][1]: " + li.get(1)[1]);
}
}
Example 2: two dimensional array in java example program
int[][] a = new int[3][4];