Check Vowel or Consonant in Java:

public class VowelConsonant {

 public static void main(String[] args) {

 char ch = ‘A’;

 if (ch == ‘a’ || ch == ‘e’ || ch == ‘i’ || ch == ‘o’ || ch == ‘u’

 || 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:

A is a vowel.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *