Home Java Beginners Arrayexamples Multi-dimensional arrays



Multi-dimensional arrays
Posted on: May 28, 2007 at 12:00 AM
In this section, you will learn about mult-dimensional array in java.

Multi-dimensional arrays

     

So far we have studied about the one-dimensional and two-dimensional arrays. To store data in more dimensions a multi-dimensional array is used. A multi-dimensional array of dimension n is a collection of items. These items are accessed via n subscript expressions. For example, in a language that supports it, the element of the two-dimensional array x is denoted by x[i,j]. 
The Java programming language does not really support multi-dimensional arrays. It does, however, supports an array of arrays. In Java, a two-dimensional array 'x' is an array of one-dimensional array. For instance :-

  int[][] x = new int[3][5];

The expression x[i] is used to select the one-dimensional array; the expression x[i][j] is ued to select the element from that array. The first element of this array will  be indexed with the "0" value and the last integer will be referenced by "length-1" indexed value. There is no array assignment operator.

Related Tags for Multi-dimensional arrays:
javacprogrammingarraysarraydatascriptlanguageiosedipvicollectionexpressionportnewinstanceintsupportelementforieexampleprogramexpressionstoexpressramexamdimensionsstoresselanportsssieititemitemsmultinotuseulimceinnorealsubmulti-dimensionalstamntoutminminjesememsallagemehowproppdotorxaxampssusubscriptsoesscolatishaimellnotecollectmplpresspreraydimensioneaandarcccollectrtrtsxpvatwscrssriripthsubsavstaccessabhatdimensionalpleplprmindonogrolo


Ask Questions?    Discuss: Multi-dimensional arrays  

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.