check if scanner input is integer code example Example: scanner check if int boolean isAnInt = scanner.hasNextInt();