Java char type check upper case char by ASCII value

Description

Java char type check upper case char by ASCII value


public class Main {
    public static void main(String[] argv) throws Exception {
        char cr = 'a';
        System.out.println(isUpperChar(cr));
    }/*from  w  w  w.  ja v a2s.com*/

    public static boolean isUpperChar(char cr) {
        if (cr >= 'A' && cr <= 'Z') {
            return true;
        } else {
            return false;
        }
    }
}



PreviousNext

Related