Friday, February 1, 2008

3 D Arrays:


3 D Arrays:

Today I will explain how 3 D arrays are created on the heap,Lets consider following example while demonstrating:
public class test{
public stati void main(String[] arg){
int[][][]x=new int[3][][]; // Line 1
int i = 1,j;
x[0]=new int[4][]; //Line 2
x[1]=new int[2][]; // Line 3
x[2]=new int[5][]; //Line 4

for(j=0;j{
x[i][j]=new int[i+j+1];
}
}
}

No comments: