publicclass Alphabet {publicstaticvoid main(String[] args) {char c = 'A';
String output = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
? c + " is an alphabet."
: c + " is not an alphabet.";
System.out.println(output);
}}
Java Program to Check Alphabet using ternary operator.
Reviewed by
on
December 20, 2019
Rating: 5
No comments: