I am trying to understand the concept of multidimensional arrays in java. Below is the posted code.
int [] [] [] x = new int [3] [] [];
int i, j;
x[0] = new int[4][];
x[1] = new int[2][];
x[2] = new int[5][];
for (i = 0; i < x.length; i++)
{
for (j = 0; j < x[i].length; j++)
{
x[i][j] = new int [i + j + 1];
System.out.println("size = " + x[i][j].length);
}
}
}
I do not understand what is being stored in "x[0] = new int[4][]; " and also what is the idea behind writing like that? Any suggestions would be highly helpful.