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
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: 1509
    
    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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I don't know what's wrong with my for loop in method