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';
                    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");
                                System.out.println( ch + " is not Vowel");

Java Program Vowel or Not Example

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular 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.

Related Articles