Java Program to Check Whether an Alphabet is Vowel or Consonant
In this example, we are giving a program to check wheather an alphabet is vowel or consonant.
To check an alphabet is vowel or consonant:
# To check an alphabet is vowel or consonant
public class VowelConsonant {
public static void main(String[] args) {
char ch = 'o';
if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
System.out.println(ch + " is vowel");
else
System.out.println(ch + " is consonant");
}
}
Output:
o is vowel