Skip to content

Instantly share code, notes, and snippets.

@BT-ICD
Created January 16, 2021 16:47
Show Gist options
  • Save BT-ICD/da39f1860f48d5b6a9b76c49a4074235 to your computer and use it in GitHub Desktop.
Save BT-ICD/da39f1860f48d5b6a9b76c49a4074235 to your computer and use it in GitHub Desktop.
Switch case demo: To determine particular character is vowel or not.
/**
* 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