john price wrote:
1) never use == for
String comparison. Always use .equals().
2) br.readLine() will read the next line each time it's called. I don't think you want that, but to use the currently read line instead.
3) In that case, the loop already guaranteed that the result is not null, so the second part can be skipped.
The new start of your loop:
One more possible improvement: use a switch instead of the "if check == 0 else if check == 1 ..." part.