I am trying to have an input asking me to select a number 1-99, I want too have this system.close(0) after 2 failed attempts, if anyone could help me it would be appreciated.
package joey;
import java.util.Scanner;
public class Joey {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while (true) {
System.out.println("Please enter an number between 0-99: ");
int n = input.nextInt();
if ((n > 99) || (n < 1))
System.out.println("Invalid number");
else
break;
}
}
}