NonPrimitive array
In this program we illustrate how to declare Multi Dimensional arrays.We have a used a 2D array to explain this concept.It deals with the non primitive type of array so the initialization is done throughclass constructors.
/*
http://www.ProbCOMP.com
In this program we illustrate how to declare Multi Dimensional arrays.
We have a used a 2D array to explain this concept.It deals with the
non primitive type of array so the initialization is done through
class constructors.
*/
public class MultiDimensionalNonprimitiveArray{
public static void main(String args[])
{
Integer[][] array = {
{new Integer(1) , new Integer(2) },
{new Integer(3) , new Integer(4) },
{new Integer(5) , new Integer(6) }
};
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.print(array[i][j]+" ");
}
System.out.println();
}
}
}
Download Program


