aspose file tools*
The moose likes Beginning Java and the fly likes local variable count and array[count]: Too Many Variables to Count! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "local variable count and array[count]: Too Many Variables to Count!" Watch "local variable count and array[count]: Too Many Variables to Count!" New topic
Author

local variable count and array[count]: Too Many Variables to Count!

Robin Lane
Ranch Hand

Joined: Apr 30, 2008
Posts: 76
I'm struggling with an itty bitty little puzzle. I can't for the life of me figure out exactly what is being referred to in the following code:





Disclaimer: The author of this post makes no claims, implied or otherwise, as to her ability to understand anything but the simplest of answers. Further, the author of this post has no programming background whatsoever and has taken one Java Programming class which was 9 weeks long. She does want to learn, so please teach patiently.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18743
    
  40

but where does array[counter] come from?


It comes from the first line of the main() method, where you declared the array. Now, since you never set any of the values, they should all have the default value, which for ints is zero.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Robin Lane
Ranch Hand

Joined: Apr 30, 2008
Posts: 76
Henry, thank you so much for answering my question. I have no previous programming experience and Java is a little more abstract than the way I normally think.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: local variable count and array[count]: Too Many Variables to Count!