jon ninpoja wrote:I know this... The point is the conditional isn't working its looping OK regardless of what key is pressed.
I don't think that will work; t would expect input like −128 or 127 or all stations between.Carey Brown wrote:. . . you could try scan.nextByte().
jon ninpoja wrote:thanks norm am i on the right path? would a do-while loop not be better for this situation,or doesnt it matter?
Liutauras Vilda wrote:
jon ninpoja wrote:thanks norm am i on the right path? would a do-while loop not be better for this situation,or doesnt it matter?
You didn't get what Norm was telling you.
The line 1 you see simply takes an input from the user and discards it, or more precisely doesn't save.
What you probably want to do, is to assign the returned value in line 1 to some variable and then this variable check within the if statement similarly as you do now.
i.e.
String enteredByUser = userInput.next();
Jesse Schlicklin wrote:Once something is read in then it goes straight to the garbage collector unless its placed somewhere
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |