From that I assume that if the translation is NOT successful, the scanner does NOT advance, ie it leaves the bad data in the buffer.
I used buffer in the generic sense referring to a place in the...
Type: Posts; User: Norm
From that I assume that if the translation is NOT successful, the scanner does NOT advance, ie it leaves the bad data in the buffer.
I used buffer in the generic sense referring to a place in the...
You can use another Scanner class method to read the bad data from the Scanner's buffer.
For debugging you should also print out a message showing the bad data that was read.
Did you read and understand the rest of my post#11?
Can you copy the first part of the console showing what was entered and what the code printed out?
Read the API doc for the nextDouble() method to see what it does:
when there is good data
when...
Look at the code. Does it do that?
EDIT: Looks like Greg has fixed it for you.
The while() loop will continue to execute as long as the expression inside of the loop has a true value.
What was the value of the expression in the while loop when it executed? For the loop to...
Please edit your post and wrap your code with code tags:
YOUR CODE GOES HERE
to get highlighting and preserve formatting.
What would keep the loop executing? What is the value of the...