Java program to check input Alphabet is Vowel or not

import java.util.Scanner;
class scan
{
 public static void main(String arg[])
 {
   char x;
   Scanner kb=new Scanner(System.in);
   System.out.println("Enter Alphabet:- ");
   x=kb.next().charAt(0);
   if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u'||x=='A'||x=='E'||x=='I'||x=='O'||x=='U')
    {
      System.out.println(x+" is a Vowel");
    }
   else
    {
     System.out.println(x+" is not a Vowel");
    }
  }
}

OUTPUT:-

Leave a Reply

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