logo

Java IsDigit() Method


Show

The method establishes whether the particular char cost is a digit. Java Character isDigit() Method. The isDigit(char ch) system of Character class normally establishes whether the known character is a digit or not. Usually, a character is believed as a digit if it’s a universal category given by Character. getType(ch), is DECIMAL_DIGIT_NUMBER.

Syntax

boolean isDigit(char ch)

Parameters

Here is the detail of parameters −

  • ch − Primitive character type.

Return Value

  • This method returns true if the passed character is really a digit.

Example

public class Test {

   public static void main(String args[]) {
      System.out.println(Character.isDigit('c'));
      System.out.println(Character.isDigit('5'));
   }
}

Output

false
true

Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.