Asad Kazmi said:
hi,
I want to know that in multidimensional array lenght of array is calculated
like this procedure or any other
Test[x][y] row (x)+column(y) = z Is this correct ?
In Java there is no such thing as a multidimensional array.
int[][] ints // is an array of arrays.
Length can only ever be attributed to one of those arrays.
So for int[][] x = new int[4][3];
There are 4 arrays of length 3 and one array of arrays of length 4
syntactically as:
int length1 = x.length; // ==4
int length2 = x.length[0]; // ==3
int length2 = x.length[1]; // ==3
int length2 = x.length[2]; // ==3
Note that the arrays do not need to be all the same length:
int[][] y = new int[4][];
y[0] = new int[1];
y[1] = new int[2];
y[2] = new int[3];
int length1 = y.length; // ==4
int length2 = y.length[0]; // ==1
int length2 = y.length[1]; // ==2
int length2 = y.length[2]; // ==3
HTH