Check for character is letter or not.


 

Check for character is letter or not.

This example check for the character is letter or not. It returns Boolean value.

This example check for the character is letter or not. It returns Boolean value.

Description:

This tutorial demonstrate the use of Character.isLetter() method which checks whether the value stored in char data-type variable is letter or not.

Code:

public class CheckLetter {
  public static void main(String[] args) {
    char charVar = 'a';
    if (Character.isLetter(charVar)) {
      System.out.println("true");
    else {
      System.out.println("false");
    }
  }
}

Output:

Download this code

Ads