Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Java isDigit() Method

Java isDigit() Method

Java Character ClassJava Character Class


The isDigit() method is used to determine whether the specified character is a digit.

Syntax



public static boolean isDigit(char ch)

Parameters

Return Value

If the character is a digit, it returns true; otherwise it returns false.

Example



public class Test {



    public static void main(String args[]) {

        System.out.println(Character.isDigit('c'));

        System.out.println(Character.isDigit('5'));

    }

}

The execution result of the above program is:



false

true


Java Character ClassJava Character Class