Help In understanding Multi Dimentional Arrays
<p>I have been googling a lot to get tutorials to understand from 3-D arrays going but it seems all the tutorials are in 2-D arrays. So i need a little explanation to understand from 3-D arrays going.</p>

<p>I really understand 2-Dimensional arrays very well but am finding it hard to understand 3 and 4 etc dimensional arrays. I know that 2-D arrays stands for rows and columns but what about this 3-D arrays:</p>

<p>My understanding of the code below is that there should be 3 rows and 4 columns but the 5 at the last position makes it look different. I need help in understanding why there are 12 rows and 5 columns. And also if you can help me in understanding 4 or 5-D arrays</p>

<p>Thanks.</p>

<pre><code> class ThreeDMatrix

{

public static void main(String[] args) 

{

int threeD[][][] = new int[3][4][5];

int i,j,k;

for (i=0; i&lt;3; i++)

for(j=0; j&lt;4; j++)

for (k=0; k&lt;5; k++)

threeD[i][j][k]= i*j*k;


{

for(i=0; i&lt;3; i++)

for(j=0; j&lt;4; j++){

for (k=0; k&lt;5; k++ )

{

System.out.print("-" + threeD[i][j][k]); 

}

System.out.println();

}

System.out.println();

}

}
}
</code></pre>

<p>OUTPUT:</p>

<pre><code>-0-0-0-0-0

-0-0-0-0-0

-0-0-0-0-0

-0-0-0-0-0

-0-0-0-0-0

-0-1-2-3-4

-0-2-4-6-8

-0-3-6-9-12

-0-0-0-0-0

-0-2-4-6-8

-0-4-8-12-16

-0-6-12-18-24
</code></pre>

<p>Please sorry for the poor rendering of the code. I don't really know how to use the code tags properly. If someone will show me then i will repost . thanks</p>
