Whats wrong with this while loop?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-04-09T20:27:18Z Indexed on 2010/04/09 20:33 UTC
Read the original article Hit count: 128

Filed under:
|
|
    boolean r = false ; int s = 0 ;
    while (r == false) ; 
    {
        s = getInt() ; 
        if (!(s>=0 && s<=2)) System.out.println ("try again not a valid response") ; 
        else r = true ; 
    }

The text never displays itself even when a 3 or a 123 is entered and the loop never terminates. Whats wrong here?

© Stack Overflow or respective owner

Related posts about java

Related posts about while-loops