Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.10 seconds.

  1. Replies
    11
    Views
    1,387

    Re: Exception in thread "main"?

    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...
  2. Replies
    11
    Views
    1,387

    Re: Exception in thread "main"?

    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-...
  3. Replies
    11
    Views
    1,387

    Re: Exception in thread "main"?

    The code you just posted works fine for me. Can you post the exact input you're using?
  4. Replies
    11
    Views
    1,387

    Re: Exception in thread "main"?

    And what happened when you did that? Can you post your updated code, along with the full text of your input and error?
  5. Replies
    11
    Views
    1,387

    Re: Exception in thread "main"?

    Where have you tried placing it?
  6. Replies
    11
    Views
    1,387

    Re: Exception in thread "main"?

    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...
Results 1 to 6 of 6