Home Java Java-conversion Three Dimensional Array program
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Three Dimensional Array program

Advertisement
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

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 25, 2008

Related Tutorials

Ask Questions?    Discuss: Three Dimensional Array program  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Mr.Osoble
November 15, 2011
Java

thank you for your posting three dimentional in java many thanks
karthika
July 15, 2013
comments

i want manual explanation about about three dimensional arrar
DMCA.com