April 2015 | VirtualSpecies

This website uses cookies to ensure you get the best experience. More info...

Java Two-Dimensional Array

The arrays we used so far were uniform series arrays, where all the array elements stay in a simple list, like in a column. This is the structure of one-dimensional array, where all elements fit in one list (life is very simple). But sometimes, you may need to divide the list in a delimited sections.

     For example, if you have an array of STUDENTs, and you want to add GRADEs on part on that array, and also want to include PARENTs on that array. What do we do? Well, instead of creating second array, we can add another dimension with the existing array (life is still simple). This is the idea of a multi-dimensional array. So, we can say, multi-dimensional array is a series of arrays where each array holds its own sub-array. We talked about one-dimensional arrays in our last post, and now we will walk with two-dimensional arrays and even three-dimensional arrays. Ok friends, let’s break the wall between multi-dimensional arrays and us. First take a look at this image..