wood burning stoves*
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 Murach's Java Servlets and JSP this week in the Servlets 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.
subject: length of array
Similar Threads
Two-dimensional array lengths????
passing values
How to sort two dimentional array in javascript
Matrix Length?
Arrays. Making An array bigger???