Scanner scan = new Scanner(;
System.out.print("Enter a digit: ");
int inputDigit = scan.nextInt();
boolean checkDigit = (Character.isDigit(inputDigit)) ? true : false;

Hi, I was studying some external resource and tried this example actually made up this code
but even after i enter digit (“0”, “1”, “2” … “9”) it returns false. What do i need to do to recieve true result via scanner.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.