java tutorial - java tutorial - Java - Method Character.isDigit() - java programming - learn java - java basics - java for beginners



Java characters isdigit

Learn Java - Java tutorial - Java characters isdigit - Java examples - Java programs

Description

The Character.isDigit() method — It defines whether the specified char value is a digit.

Syntax


boolean isDigit (char ch)   
click below button to copy the code. By - java tutorial - team

Options

Detailed information about the parameters:

  • ch is a primitive character type (char).

Return value

  • In Java, Character.isDigit() returns true if the passed character is a digit.

Sample Code

public class Test {

   public static void main (String args []) {
      System.out.println ("Value \"7\"digit? Answer:" + Character.isDigit ('7'));
      System.out.println ("Value \"0\"digit? Answer:" + Character.isDigit ('0'));
      System.out.println ("Value \"v\"digit? Answer:" + Character.isDigit ('v'));
      System.out.println ("Value \"$\"Digit? Answer:" + Character.isDigit ('$'));
      System.out.println ("Value \"@\"digit? Answer:" + Character.isDigit ('@'));
   }
}
click below button to copy the code. By - java tutorial - team

Output

Value "7"digit? Answer:true
Value "0"digit? Answer:true
Value "v"digit? Answer:false
Value "$"Digit? Answer:false
Value "@"digit? Answer:false

Related Searches to Java - Method Character.isDigit()