 <p>Since the statements are in a try block there's a chance that they will fail, and your program has a chance of trying to use a non-initialized variable. The solution is to initialize the variables to a default value that makes sense, i.e.,</p> <pre><code>int guess = -1; // some default value </code></pre> <p>You should also wrap the while loop around the try/catch block. Don't let the program progress until inputted data is valid.</p> <pre><code>boolean validGuess = false; while (!validGuess) { // prompt user for input here try { guess = Integer.parseInt(iConsole.nextLine()); if (/* .... test if guess is valid int */ ) { validGuess = true; } } catch (NumberFormatException e) { // notify user of bad input, that he should try again } } </code></pre> <p>You could even encapsulate all of this into its own method if you need to do similar things throughout the program.</p>