posted 24 years ago
Hi Lee,
When you are dealing with multi-diamensional arrays you would want to write the code in the following manner:
I have written a general example which may not be necessarily applicable to your question. I have defined a 2-D array and here is how I would use length property of an array:
// Initialize and create a 2 D array
int[][] a1 = {
{ 1, 2, 3, },
{ 4, 5, 6, },
};
Use length property of array
for(int i = 0; i < a1.length; i++){
for(int j = 0; j < a1[i].length; j++){
System.out.println ("a1[" + i + "][" + j + "] = " +
a1[i][j]);}}
Hope this helps !!
Regards,
Milind
[This message has been edited by Milind Kulkarni (edited July 17, 2000).]