I just started taking programming course in Java and I'm trying to write a guessing game. I would like the user to be able to start the game over again without having to restart the program. Every time I try to set up a loop to do this it never goes through the enter loop again. I'm just not constructing the loop properly, but I'm not sure how I can correct it. Any help or suggestions on how to improve my code would be appreciated. Thanks in advance!
One thing i would suggest...use a bunch of System.out.println statements to see what is going on. If something isn't looping like you think it should, print out what you are comparing and prove that is is really equal to what you think it is. odds are it is not.
Print out your "playAgain" variable just before your line 58 and see what it is.
Print out each time you enter the top of a loop, so you know if you are looping (and how many times).
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Apr 18, 2013
Thanks for the fast reply and the help. I was able to fix my code and have it working now.