Two-Dimensional Array

A two dimensional array can be looked upon as an array of arrays. It can be defined as:
final int ROWS = 3;
final int COLUMNS = 2;
int[][] a = new int [ROWS][COLUMNS];

This array has three rows and two columns

a[0][0] a[0][1]
a[1][0] a[1][1]
a[2][0] a[2][1]

To assign a value to any one element 

a[1][0] = 3;

Another way of declaring and assigning values to a two dimensional
array is

int[][] b = { {9, 8, 7}, {6, 5, 4}};

This is equivalent to

b[0][0] = 9  b[0][1] = 8  b[0][2] = 7
b[1][0] = 6  b[1][1] = 5  b[1][2] = 4

To sum over the elements of an array, sum over the columns first and
then the rows.

int sum = 0;

for ( int i = 0; i < ROWS; i++ )
  for ( int j = 0; j < COLUMNS; j++ )
    sum += a[i][j];