Multidimensional Array Traversal in Java - DZone Java
Multidimentional Arrays
An array is a container object in Java that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed. e.g. an array of size 10 is defined below:
public class ArrayDemo {
private int arraySize=10;
public int[] arrayOfIntegers = new int[arraySize];
}
The above code is an example of single dimentional array. In other words the array grows only in one direction. Many a times we need arrays that grow in more than one dimention. Such arrays are called multi-dimentional arrays. For simplicity, let's talk about a 2-D array. 2-D arrays are very useful when we need a matrix or x-y plots/graphs. Below is an example of a square 2-D array.
Read full article from Multidimensional Array Traversal in Java - DZone Java
No comments:
Post a Comment