Java program to find whether given character is vowel or consonant

In English alphabet the characters 'a', 'e', 'i', 'o','u' are vowels and remaining letters are consonants. To find whether the given letter is a vowel or consonant.

Using loop and or operator verify whether given character is 'a' or 'e' or 'i' or 'o' or 'u' else it is consonant.


import java.util.Scanner;
public class VowelOrConsonant {
   public static void main(String args[]){
      System.out.println("Enter a character :");
      Scanner sc = new Scanner(;
      char ch =;
      if(ch == 'a'|| ch == 'e'|| ch == 'i' ||ch == 'o' ||ch == 'u'||ch == ' '){
         System.out.println("Given character is an vowel");
         System.out.println("Given character is a consonant");


Enter a character :
Given character is an vowel
Enter a character :
Given character is a consonant
karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know