Vowel or consonant in java using if else

Vowel or consonant in java using if else. In the java programming language, you can learn how to decide whether a letter is a vowel or a consonant. a, e, I o, and u are letters that represent vowel. Rest of the letters are consonants.

public class Main
{
public static void main(String[] args)
{
char ch = 'e';
if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' )
System.out.println(ch + " is a vowel");
else
System.out.println(ch + " is a consonant");
}
}

Output

e is vowel