check character is alphabet or not in java code example
Example: check element is alphabet java
class Main {
public static void main(String[] args) {
// declare a variable
char c = 'a';
// checks if c is an alphabet
if (Character.isAlphabetic(c)) {
System.out.println(c + " is an alphabet.");
}
else {
System.out.println(c + " is not an alphabet.");
}
}
}