write a Java Program to Check Whether a Character is Alphabet or Not

write a Java Program to Check Whether a Character is Alphabet or Not

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
public class Alphabet {

    public static void main(String[] args) {

        char c = '*';

        if( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
            System.out.println(c + " is an alphabet.");
        else
            System.out.println(c + " is not an alphabet.");
    }
}

 

Final output

1 thought on “write a Java Program to Check Whether a Character is Alphabet or Not”

Leave a Comment