Home Java Java-conversion Three Dimensional Array program



Three Dimensional Array program
Posted on: June 25, 2008 at 12:00 AM
This is a very simple Java program. In this program we will learn how to use three dimensional array.

Three Dimensional Array program

     

This is a very simple Java program. In this program we will learn how to use three dimensional array. Firstly, we have to define class name "ThreeDMatrix" . We are going to create 3 by 4 by 5 program. We are going to make three dimensional array having multi rows and columns.

By using the multidimensional array we are going to make a matrix. Now in this program use the three for loop for multi dimensional array. After that use the display the values by using println() method .

Here is the code of this program

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[i][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[i][j][k])
  }
 System.out.println();
  }
  System.out.println();
 }
  }
}

Download this Example

Related Tags for Three Dimensional Array program:
javacarrayclassstliomakematrixcolumnvinamecolumnsthissimplecreaterowdefinerowsprogramtolearnramaviwseareilmultiuseulimfirstinasmhavingtrjcldmmehowhrproumnseedmacolatkisirhaimellmplraygodimensioneaandarsimvinvassrithavstdimensionalfinlumpleplprndonogrolo


More Tutorials from this section

Ask Questions?    Discuss: Three Dimensional Array program  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.