Group Switch Statement in Java

The switch statement is Java's multi-way branch statement. It is used to take the place of long if-else chains, and make them more readable. However, unlike if statements, one may not use inequalities; each value must be concretely defined. The break statement is optional. If you omit the break, execution will continue on into the next case. It is sometimes desirable to have multiple cases without break statements between them. For example, consider the following program:

    case 1 :
    case 2 :
    case 3 :
    case 4 :
         // code inside the combined case
     case 5 :
    case 6 :
         // code inside the combined case value
     default :
         // code inside the default case .

Source Code

import java.util.Scanner;
//Group Switch
public class group_switch {
    public static void main(String args[]) {
       char c;
        System.out.println("Enter The Character : ");
        Scanner in =new Scanner(;;
        switch (c)
            case 'a':
            case 'e':
            case 'i':
            case '0':
            case 'u':
            case 'A':
            case 'E':
            case 'I':
            case 'O':
            case 'U':
                System.out.println(c + " is a Vowels");
                System.out.println(c + " is Consonant");


Enter The Character :
u is a Vowels
To download raw file Click Here

Basic Programs