You are here:   HomeJava ProgrammingControl Structures in JavaPrime Number Program in Java Using BufferedReader Example.
by Dinesh Thakur Category: Control Structures

In the switch statement, since same statements has to be executed corresponding to different cases ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U') so we write the statements with the last case. The break statement causes the switch statement to terminate when any of the vowels is entered.

//Program to Check whether a Given Character is Vowel or Not

public class VowelorNot
{
         public static void main(String[] args)
     {
         char ch='z';
        
         switch(ch)
             {
                    case 'a': case 'A':
                    case 'e': case 'E':
                    case 'i': case 'I':
                    case 'o': case 'O':
                    case 'u': case 'U':
                                 System.out.println( ch + " is Vowel");
                                             break;  
                    default:
                                System.out.println( ch + " is not Vowel");
             }
                              
       }
}

Java Program Vowel or Not Example



Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.



What's New and Popular





Popular Article