Java Character isDigit() Method Tutorial

In this section, we will learn what the Character isDigit() method is and how to use it in Java.

What is Java Character isDigit() Method?

The `isDigit()` method is used to see if the target character is a digital number like `1`,`2`, `3` etc.

Java isDigit() Method Syntax:

static boolean isDigit(char ch)

isDigit() Method Parameters:

The isDigit() method takes one argument, and that is the character we want to check and see if it’s a digital number or not.

isDigit() Method Return Value:

The return value of this method is a boolean.

If the target character was a digital number, the return value will be `true` otherwise is `false`.

Example: using Character isDigit() method

public class Simple {

    public static void main(String args[]) {

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

Output:

false

false

true
Facebook
Twitter
Pinterest
LinkedIn

Top Technologies