Created
January 16, 2021 16:47
-
-
Save BT-ICD/da39f1860f48d5b6a9b76c49a4074235 to your computer and use it in GitHub Desktop.
Switch case demo: To determine particular character is vowel or not.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* To determine particular character is vowel or not. | |
* Switch case example | |
* */ | |
public class SwitchCaseDemoVowel { | |
public static void main(String[] args) { | |
char ch='e'; | |
//Converts the character to uppercase | |
ch = Character.toUpperCase(ch); | |
switch (ch){ | |
case 'A': | |
case 'E': | |
case 'I': | |
case 'O': | |
case 'U': | |
System.out.println(ch + " is vowel"); | |
break; | |
default: | |
System.out.println(ch + " is not vowel"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment