| Author |
Problem with Java Scanner - Please Help!
|
Kevin Behr
Greenhorn
Joined: Jun 29, 2006
Posts: 23
|
|
Hey all - so I am creating a non-graphical version of the game Mastermind (which entails guessing a secret color code within the fewest amount of tries possible - here is a link containing an example [http://www.irt.org/games/js/mind/]). With my game, you first choose for either a computer-generated secret code or a human entered code, and then the player is prompted to enter the first guess of the color sequence. It should go like this: Color 1: ____ [ENTER] Color 2: ____ [ENTER] Color 3: ____ [ENTER] Color 4: ____ [ENTER] But insted, it goes like this... Color 1: Color 2: ____ [ENTER] Color 3: ____ [ENTER] Color 4: ____ [ENTER] The problem lies within my ConfirmYes() and my ConfirmNo() methods. Could you please try giving my code a run and maybe seeing where the problem lies? Thanks!
|
 |
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
|
|
|
Note that according to the Javadocs, nextLine() doesn't block. But the next() method may.
|
 |
Kevin Behr
Greenhorn
Joined: Jun 29, 2006
Posts: 23
|
|
|
That did the trick, thanks alot!
|
 |
 |
|
|
subject: Problem with Java Scanner - Please Help!
|
|
|