aspose file tools*
The moose likes Beginning Java and the fly likes I don't know what's wrong with my for loop in method 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 "I don Watch "I don New topic
Author

I don't know what's wrong with my for loop in method

Tracy Villa
Greenhorn

Joined: Nov 03, 2012
Posts: 28
Hi, so I have a program where I need to generate five random numbers and put them into a array. But my for loop isn't working The error I get is



Here is my code so far:



Please help
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1505
    
    5

Hi Tracy,

This is because you are trying to access ndx from out of its scope.

Hint 1: Look closely. ndx is declared within for loop. It is really being access inside for loop?
Hint 2: Where does your for loop end?


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Tracy Villa
Greenhorn

Joined: Nov 03, 2012
Posts: 28
Oops I have a semi-colon after my for loop
Tracy Villa
Greenhorn

Joined: Nov 03, 2012
Posts: 28
Thank you so much
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: I don't know what's wrong with my for loop in method