Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.10 seconds.

  1. Replies
    5
    Views
    1,038

    Re: How to validate user input in a loop

    Ah, I understand what you meant now.

    The problem is this: nextInt() reads the next integer, which are separated by white space. The enter key counts as white space, so it isn't read in when you...
  2. Replies
    5
    Views
    1,038

    Re: How to validate user input in a loop

    If the sc.nextInt() function throws an Exception (which it will if you enter a double), then the i++ line will not be executed.

    Step through this with a debugger, or at least add some print...
  3. Replies
    5
    Views
    1,038

    Re: How to validate user input in a loop

    Have you tried putting it in a loop?
Results 1 to 3 of 3