Java isDigit() method




#Java Character ClassJava  Character类

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

Syntax

boolean isDigit(char ch)

Parameters

  • ch

    -- The character to test.

  • Return value

Returns true if the character is a number; otherwise 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:

falsetrue


##Java Character class

Java  Character类