In this example you will learn How do you check if a character is a letter in Java Application
Java Code: Write a java program to Check Whether a Character is Alphabet or Not
1 2 3 4 5 6 7 8 9 10 11 |
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."); } |
Output: