It's been some years since I've used Java, and I'm not quite sure what the best practice for validating command line input is.
My code is currently structured like so:
while (true) {
    try { ... break; } catch(...) {...}
}
I feel that this is poor practice, because it's similar to using a goto statement in a way.
Is there a better way to validate user input?
Is simply using a boolean the preferred method?
Edit:
More specifically, validating user-input from the stdin (scanner).
Something to the extent of:
while(true){
    try {
        userInput = Integer.parseInt(stdin.next());
        break;
    } catch (InputMismatchException e) {
        ...
    }
}
 
    