how to work with two dimensional array in java code example
Example 1: java two dimensional arrays
int[][] multiples = new int[4][2];
and 2 columns
String[][] cities = new String[3][3];
and 3 columns
Example 2: Multidimensional array in java
public class SimpleTwodimensionalArray
{
public static void main(String[] args)
{
int[][] arrnumbers = {{2, 4},{6, 8},{10, 12}};
System.out.println("Two dimensional array in java: ");
for(int a = 0; a < 3; a++)
{
for(int b = 0; b < 2; b++)
{
System.out.println(arrnumbers[a][b]);
}
}
}
}