int[][] intArray;
double[][] doubleArray;
String[][] stringArray;
boolean[][] booleanArray;

// creating a 2D array with different data types
int[][] arr = { { 1, 2 }, { 3, 4 }, 
                { 5, 6 }, { 7, 8 }};
 
System.out.println("arr[0][0] = " + arr[0][0]);
arr[0][0] = 1

Looping through Horizontally vs. Vertically

System.out.println("row count:" + arr.length);
 
for (int i = 0; i < arr.length; i++)
{
    // Loop through all elements of current ROW
    for (int j = 0; j < arr[i].length; j++)
        System.out.print(arr[i][j] + " ");
}




for (int i = 0; i<4; i++) {
    for (int j = 0; j<2; j++){
    System.out.println(arr[i][j]);
    }
}
row count:4
1 2 3 4 5 6 7 8 1
2
3
4
5
6
7
8