I'm writing a very simple program and where I am getting 3 ints from a user and want to check to make sure they are all ints before storing them into seperate variables to process. The check I've used works on the first input but fails and throws the exception on the second two.
boolean properInt = scanner.hasNextInt();
int largest = Integer.MAX_VALUE;
boolean anError = false;
while(properInt=false){
anError=true;
System.out.println("Invalid number...whole numeric values only");
}
while(properInt =true){
int a= scanner.nextInt();
System.out.println("you entered "+ a);
int b = scanner.nextInt();
System.out.println("you entered "+ b);
int c= scanner.nextInt();
System.out.println("you entered "+ c);
}