We are uploading our contents, please refresh app.
Java Premium

write a Program in java to input a character and Check Whether an Alphabet is Vowel or Consonant

In this program, you'll learn to check whether an alphabet is a vowel or a consotant using if..else and switch statement in Java.


Program:
import java.util.*;
public class Vowel_Consonant 
{
 public static void main(String[] args) 
 {
   char ch;
   Scanner sc=new Scanner(System.in);
   System.out.println("Input any word: ");
   ch=sc.next().charAt(0); 
   if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' )
       System.out.println(ch + " is vowel");
        else
       System.out.println(ch + " is consonant");
   }
}

Output:
Input any word: 
a
a is vowel


Input any word: 
x
x is consonant

Online user

Download our android app Download App Submit your query
x

Get Updates On

Java & Premium Programs

Java Solved & Questions

Java Coding easy to use

Proper Coding

Straight Into Your INBOX!

We are going to send you our resources for free. To collect your copy at first, join our mailing list. We are promising not to bother you by sending useless information. So don't miss any updates, stay connected!