Example: Switch Case to select vowel and consonant.
public class SwitchCase {
public static void main(String[] args) {
char ch = 'x';
switch (ch) {
case 'a':
System.out.println(ch + " is vowel");
break;
case 'e':
System.out.println(ch + " is vowel");
break;
case 'i':
System.out.println(ch + " is vowel");
break;
case 'o':
System.out.println(ch + " is vowel");
break;
case 'u':
System.out.println(ch + " is vowel");
break;
default:
System.out.println(ch + " is consonant");
}
}
}