Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

3D Array

I am having problem understanding the output of the code:

3darrays.java
public class 3DArrays {
    public static void main(String args[]){
        int threeD[][] = new int[3][4][5];
         int  i, j, k = 0;


        for( i = 0; i<3; i++){
            for ( j = 0; j<4; j++){
                            for( k = 0; k<3; k++) {
                threeD[i][j] [k]= i*j*k;



        for( i = 0; i<3; i++){
            for ( j = 0; j<4; j++){
                            for( k = 0; k<3; k++) {

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

System.out.println();

                    }

    }

}

/* as you can see the output is:

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 2 4 6 8 0 4 8 12 16 0 6 12 18 24

just explain me the output please */