The loop doesn't end when you enter the wrong input because of i--;

The wrong input causes the InputMismatchException to be thrown and the i--;
is causing an infinate loop.

Even by removing...