This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: length of array
 
Similar Threads
Arrays. Making An array bigger???
Two-dimensional array lengths????
passing values
How to sort two dimentional array in javascript
Matrix Length?