I have an if/else statement with a scanner in the conditions, as well as an && statement checking for the input being 100 or less. It goes like this:
Scanner input = new Scanner(System.in);
if(input.hasNextInt() && avgBefore <= 100) {
avgBefore = input.nextInt();
}
But if I put a number over 100 in, it still accepts it. Any help?
Aucun commentaire:
Enregistrer un commentaire