Latest web development tutorials

Java isDigit () method

Java Character class Java Character class


isDigit () method is used to determine whether the specified character is a digit.

grammar

boolean isDigit(char ch)

parameter

  • ch - the character to be tested.

return value

If the character is a digit, it returns true; otherwise false.

Examples

public class Test {

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

The above program execution results:

false
true

Java Character class Java Character class