The problem is that you are waiting for two numbers... change it to as follows:
Scanner in = new Scanner(System.in);
System.out.print("Enter an integer, or Q to quit: ");
int largest = Integer.MIN_VALUE;
while (in.hasNextInt())
{
int input = in.nextInt();
if (input > largest)
{
largest = input;
}
System.out.print("Enter an integer, or Q to quit: ");
}
System.out.println(largest);
The problem with your previous version of the code was that you were expected 2 numbers initially, one of them being the largest value.