Situatie
In this program, you’ll learn to check whether a given character is an alphabet or not.
Solutie
Pasi de urmat
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.”);
}
}
Output:
* is not an alphabet.
Leave A Comment?