Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

java
digit
communitycreator

What is Character.isDigit() in Java?

harris910

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'));

    }
}

RELATED TAGS

java
digit
communitycreator
RELATED COURSES

View all Courses

Keep Exploring