In the following code, I am trying to prompt a user to enter a number, and if it is less than 1, ask for another positive number.
It seems to be working until the positive number is input but the program will print a final error message after the positive number is given.
How do I stop this error message from being printed after the positive number is input?
System.out.println("Enter number");
int x = 0;
while (x < 1)
{
x = input.nextInt();
System.out.println("ERROR - number must be positive! Enter another");
}