Java


#1

Scanner scan = new Scanner(System.in);
System.out.print("Enter a digit: ");
int inputDigit = scan.nextInt();
scan.close();
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.


#2

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