| Author |
multidimensional array length
|
Tyler Jordan
Ranch Hand
Joined: Nov 17, 2003
Posts: 70
|
|
I am having trouble getting the length of the first dimension in a multidimensional array. I have the following array. data[x][y] I found some info on the net saying if I want to get the first dimension's length I do: data[x].length() However, when I compile I get: cannot resolve symbol method length() Above this part of the code I have a length method that is working fine on the same array, however I am using the following format:
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
The second one that seems to work is actually calling length() on the object at the cell [x][y] which must be a String or something that has a length() method. Array doesn't have a length() method, it has a length attribute - no parens. You'd have to call the inventors of the language to ask why some things have length, others have length() and others have size(). Remembering that a multi-dimensional array is just an array of arrays ... Cheers! [ May 19, 2005: Message edited by: Stan James ]
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
 |
|
|
subject: multidimensional array length
|
|
|