It's not a secret anymore!*
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "length of array" Watch "length of array" New topic
Author

length of array

Aaron Parker
Greenhorn

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.
Tobias
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: length of array