Java Data Type How to - Character: is Upper/Lower Case








Question

We would like to know how to character: is Upper/Lower Case.

Answer

    /*from w  w w  .ja v a 2 s.c  om*/
public class MainClass {
  public static void main(String[] args) {
    char symbol = 'A';

    if (Character.isUpperCase(symbol)) {
      System.out.println("true");
    }else{
      System.out.println("false");
    }
  }
}

    
public class MainClass {
  public static void main(String[] args) {
    char symbol = 'A';

    if (Character.isLowerCase(symbol)) {
      System.out.println("true");
    }else{
      System.out.println("false");
    }
  }
}