"Sam G-H,"
Welcome to JavaRanch!
Please revise your display name to meet the
JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names, with a first
and a last name. Initials are okay for a first name, but not a last name.
You can edit your display name
here. Thank you for your prompt attention!
-Marc
Originally posted by Sam G-H:
Could someone tell me what is wrong with this program? ...
The compiler errors are telling you what's wrong...
But if you haven't seen these before, they might not be obvious.
First, on line 6, the compiler thinks that "While" is the name of a method you're trying to call. The reason is that
Java is case sensitive, so "While" (with an uppercase 'W') is
not the same as the keyword "while" (with a lowercase 'w').
Second, on line 17, the compiler thinks that you're trying to compare beerNum to some variable called 'O' because you've mistyped the letter 'O' instead of zero.
Once you've corrected these 2 errors, the code will compile, but then you will have a
really curious problem when you try to run it. This code will enter an infinite loop and appear to "freeze up" without any output. (You will need to press Ctrl+C to break out.)
The reason is on line 6...
while(beerNum> 0); {
Do you see what's wrong here?
[ October 27, 2007: Message edited by: marc weber ]