File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multidimensional array length

 
Tyler Jordan
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic