Three Dimensional Array Program in Java1 min read

Let us go through a three dimensional array in java language. Before that, you may go through the following topic in java.

Three Dimensional (3D) Array program

3D arrays are the multidimensional array in java. They are quite complicated as they run on three loops. In order to initialize or display the array, we need three loops. The inner loop is for one dimensional array, the second one is for the two dimensions and the outer loop makes the third dimensional array.

The program below is an example of 3d array in java. We will initialize the 3D array and display the output on the screen.


Three Dimensional Array Program in Java

Output:

Enter the Index 1 for Array: 2
Enter the Index 2 for Array: 2
Enter the Index 3 for Array:

Enter the elements:
arr[0][0][0]: 1
arr[0][0][1]: 2
arr[0][1][0]: 3
arr[0][1][1]: 4
arr[1][0][0]: 5
arr[1][0][1]: 6
arr[1][1][0]: 7
arr[1][1][1]: 8

The enetered elements are:
arr[0][0][0]: 1
arr[0][0][1]: 2
arr[0][1][0]: 3
arr[0][1][1]: 4
arr[1][0][0]: 5
arr[1][0][1]: 6
arr[1][1][0]: 7
arr[1][1][1]: 8


MORE

Find the output ab, cd, ef, g for the input a,b,c,d,e,f,g in Javascript and Python

In this tutorial, we will write a program to find a pairs of elements from an array such that for the input [a,b,c,d,e,f,g] we will …

String Pattern Programs in C

In this tutorial, we will write various C pattern programs for String. Before that, you may go through the following topics in C. for loop …

Java Program to Find pair of Integers in Array whose sum is given Number

In this tutorial, we will write a program to find a pair of elements from an array whose sum equals a given number in java …

Program to Print Diamond Alphabet Patterns in C

In this tutorial, we will learn to write a C program to print Diamond patterns using alphabets/characters. However, in this tutorial, we will create a …

Half Diamond Pattern in C using Alphabets

In this tutorial, we will learn and code the half diamond alphabet patterns in C programming language. However, in this tutorial, we will create a …

Half Pyramid of Alphabets in C

In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in …