Search:

Type: Posts; User: camel-man

Search: Search took 0.09 seconds.

  1. Replies
    5
    Views
    1,046

    Re: How to validate user input in a loop

    Right, but I thought that it would then eventually reach the top of the while loop and then go back into the try statement.

    I ended up adding sc.next(); in the catch statement and now all is...
  2. Replies
    5
    Views
    1,046

    Re: How to validate user input in a loop

    Yes I tried a while loop like this, but whenever I enter in a double for example. It will go into an infinite loop saying "try again wrong type"



    int i=0;
    while(i<3)
    {
    try
    {
    ...
  3. Replies
    5
    Views
    1,046

    How to validate user input in a loop

    Is there a method that allows me to check if the user entered anything other than an integer. For example I want the user only to enter an integer, I have this code.




    try
    {
    ...
Results 1 to 3 of 3