You can try adding a new boolean in while loop check.
while (win == false && shouldContinue == true)
And ask the question after,
if (guess == number)
{
System.out.println("You are correct! the number was " + number + "!");
win = true;
}
else if (guess > number)
{
System.out.println("That number is too high.");
}
else if (guess < number)
{
System.out.println("That number is too low.");
}
By the way, please include your code which gave error, if this does not work.