aspose file tools*
The moose likes Beginning Java and the fly likes Head First Java - Beat Box code - missing variable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Head First Java - Beat Box code - missing variable?" Watch "Head First Java - Beat Box code - missing variable?" New topic
Author

Head First Java - Beat Box code - missing variable?

Brian Altman
Greenhorn

Joined: Nov 16, 2012
Posts: 5
Never mind. I found the error.

Thanks anyway!
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6



Get rid of the semicolon at the end.

Brian Altman
Greenhorn

Joined: Nov 16, 2012
Posts: 5
Thanks for the quick reply Jeff!

My eyes were going crazy from looking over that code.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Brian Altman, please do not delete or modify the original question after you resolve an issue you were facing (either yourself or by help of other Ranchers). For someone who might read the thread later it can seem strange seeing answer(s) without any information about the original problem.

Welcome to the Ranch!


The quieter you are, the more you are able to hear.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Brian Altman wrote:Thanks for the quick reply Jeff!

My eyes were going crazy from looking over that code.


That extra semicolon can be hard to spot. What made it easy was the error message. It said the variable "i" wasn't defined, but obviously it was, so we must have been out of i's scope, so we look for what that scope actually is, then end result of which must be that either there's a semicolon, as you had, or there isn't, but we're referring to "i" after the for loop's closing } brace.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Head First Java - Beat Box code - missing variable?