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 vowels. The rest of the letters are consonants. It’s simple to define vowels and consonants phonologically: a vowel is any sound with no audible noise generated by restriction in the vocal tract, and a consonant is any sound with audible noise produced by constriction in the vocal tract.
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");
System.out.println(ch + " is a consonant");
e is vowel
What is char in java
Vowels vs Consonant
The word vowel is derived from the Latin word vocalis, which means “to speak.” The word vowel is widely used in English to refer to both vowel sounds and the written symbols that represent them (a,e, i,o,u).
A consonant is a sound that is not a vowel in speech. It also refers to the letters of the alphabet that represent certain sounds: consonants include Z, B, T, G, and H. All non-vowel sounds, or their equivalent letters, are consonants: A, E, I, O, U, and occasionally Y are not consonants. H and T are consonants in a hat.
Why Vowels and Consonant are used
Sounds are described by vowels and consonants. The sounds began first, and the characters we know as vowels and consonants were added later as attempts to write them down.
When the English language adopted the Roman alphabet, it had to make do with the restricted number of vowel letters available to represent the English vowel sounds, which number about 220.