Arrays in Java : Please can anu one explain the output
Hi techies ,
I am new to java and trying to understand arrays but was stuck in concepts , Please any one can explain the following is the code :
class ThreeDMatrix
{
public static void main(String args[])
{
int threeD[][][] = new int[3][4][5];
int i, j, k;
for(i=0; i<3; i++)
for(j=0; j<4; j++)
for(k=0; k<5; k++)
threeD[j][k] = i * j * k;
for(i=0; i<3; i++)
{
for(j=0; j<4; j++)
{
for(k=0; k<5; k++)
System.out.print(threeD[j][k] + " ");
System.out.println();
}
System.out.println();
}
}
}
Output of this program is :
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
I would be thankful for the help ,Regards King99 !!
I am new to java and trying to understand arrays but was stuck in concepts , Please any one can explain the following is the code :
class ThreeDMatrix
{
public static void main(String args[])
{
int threeD[][][] = new int[3][4][5];
int i, j, k;
for(i=0; i<3; i++)
for(j=0; j<4; j++)
for(k=0; k<5; k++)
threeD[j][k] = i * j * k;
for(i=0; i<3; i++)
{
for(j=0; j<4; j++)
{
for(k=0; k<5; k++)
System.out.print(threeD[j][k] + " ");
System.out.println();
}
System.out.println();
}
}
}
Output of this program is :
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
I would be thankful for the help ,Regards King99 !!
0