An array of 4 times 8 is a 2D array with 4 Rows and 8 Columns.
// Declaration of a 2D array [ROWS] [COLUMNS]
int [][] arr = new int[4][8];
// What a 2D Array looks like populated with numbers
//
// _____________________
// Row 0 | 1 0 0 0 0 0 0 7
// Row 1 | 0 0 0 0 0 0 0 0
// Row 2 | 0 0 0 0 0 0 4 0
// Row 3 | 0 0 0 0 0 0 0 0
The example array above has the number 1 place in the first row of the first column.
In the first row of the eight column the number 7 is placed.
In the third row of the seventh column the number 4 is placed.
// Accessing these values
int one = arr[0][0];
int seven = arr[0][7];
int four = arr[2][6];
Copyright © 2026 eLLeNow.com All Rights Reserved.