Ah I see that now. I was thinking of the following situation:
import java.util.Scanner;
public class Main{
public static void main(String args[]) {
Scanner myscanner = new...
Type: Posts; User: KevinWorkman
Ah I see that now. I was thinking of the following situation:
import java.util.Scanner;
public class Main{
public static void main(String args[]) {
Scanner myscanner = new...
I mean, what are you typing into the command line to give input to the Scanner? When the Scanner asks for a number, what are you giving it?
Are you sure this is the code you're running?
Edit-...
The code you just posted works fine for me. Can you post the exact input you're using?
And what happened when you did that? Can you post your updated code, along with the full text of your input and error?
Where have you tried placing it?
When the user enters a number, they press enter. So you have a double and the enter character "in" the Scanner.
Then you call the nextDouble() function, which scans past the double. But you still...