aspose file tools*
The moose likes Beginning Java and the fly likes length of array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "length of array" Watch "length of array" New topic

length of array

Aaron Parker

Joined: Jan 31, 2004
Posts: 27
How do I find out how long an array is (number of elements). How do I do that in Java?
My first incorrect guess was (as a oondition in my for loop):
for (x = 0; x < length(fictionTitles[]); ++x) {
Tobias Hess
Ranch Hand

Joined: Apr 06, 2004
Posts: 55
Like this:
for (x = 0; x < fictionTitles.length; ++x) {
Yes, no parantheses - that's a bad design in java.
I agree. Here's the link:
subject: length of array
Similar Threads
Matrix Length?
passing values
Arrays. Making An array bigger???
How to sort two dimentional array in javascript
Two-dimensional array lengths????