Share your repls and programming experiences

← Back to all posts
Vowel or consonant in java using if else
RaghunathThilag (1)

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");
System.out.println(ch + " is a consonant");


e is vowel