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