3D array three-dimensional array in Java

import java.util.*;

public class ThreeDArr {
    public static void main(String[] args) {
        int[][][] threeDA = new int[3][4][5];
        int a, b, c;
        for (a = 0; a < 3; a++)
            for (b = 0; b < 4; b++)
                for (c = 0; c < 5; c++)
                    threeDA[a][b][c] = a * b * c;

        for (a = 0; a < 3; a++) {
            for (b = 0; b < 4; b++) {
                for (c = 0; c < 5; c++)
                    System.out.print(threeDA[a][b][c] + " ");
                System.out.println();

            }
            System.out.println();
        }

    }
}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *