The Character.isDigit(char ch) java method determines if the specified character is a digit.
A character is a digit if its general category type, provided by Character.getType(ch), is DECIMAL_DIGIT_NUMBER.
Some Unicode character ranges that contain digits:
- ‘u0030’ through ‘u0039’, ISO-LATIN-1 digits (‘0’ through ‘9’)
- ‘u0660’ through ‘u0669’, Arabic-Indic digits
- ‘u06F0’ through ‘u06F9’, Extended Arabic-Indic digits
- ‘u0966’ through ‘u096F’, Devanagari digits
- ‘uFF10’ through ‘uFF19’, Fullwidth digits
Many other character ranges contain digits as well.
Note: This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the isDigit(int) method.
The isDigit(char ch) method of Character class is static thus it should be accessed statically which means the we would be calling this method in this format:
Non static method is usually called by just declaring method_name(argument) however in this case since the method is static, it should be called by appending the class name as suffix. We will be encountering a compilation problem if we call the java isDigit() method non statically.