posted 14 years ago
John,
Here's a little tip to help you get better help around here. When you ask a question like "why do I get a compiler error?" it is of unimaginable help for you to provide the exact text of the compiler error. What the compiler outputs will tell you a LOT about what your problem is, but in particular the exact line where the problem is.
In your case, you say there is an issue with your if statement...and then there are TWO if statements. So now, if someone wants to help you, they have to figure out where the error is...and some people won't bother taking the time.
Your job is to make it as easy as possible for someone to help you.
If you would have provided this:
C:\slop>javac ninety_nine_bottle.java
ninety_nine_bottle.java:26: 'else' without 'if'
else
we would know the exact problem is on line 26, that the IF block was closed somehow, and we'd know immediatly to look at the IF on line 21 instead of the IF on line 11.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors