What is Character.isDigit() in Java?

The isDigit() function returns true if a character sent as a parameter is digit; otherwise, it returns false.

Figure 1 shows a visual representation of the isDigit() function.

Figure 1: Visual representation of isDigit() function

Syntax

boolean isDigit(char character)

Parameter

The isDigit() function takes the character as a parameter.

Return value

The isDigit() function returns true if a character sent as a parameter is digit; otherwise, it returns false.

Code

class JAVA {
public static void main( String args[] ) {
//simple character
System.out.println("Character.isDigit('E'):");
System.out.println(Character.isDigit('E'));
//digit character
System.out.println("Character.isDigit('5'):");
System.out.println(Character.isDigit('5'));
}
}

Free Resources