Switch Statement without break in java

Java Programming Language Decision Making in java (Article) Decision Making in java (Program)

3756

Program:

public class SwitchExample2 {
public static void main(String[] args) {
    int number=20;
    switch(number){
    case 10:
    		System.out.println("10");
    case 20:
    		System.out.println("20");
    case 30:
    		System.out.println("30");
    default:
    		System.out.println("Not in 10, 20 or 30");
    }
}
}

Output:

20
30
Not in 10, 20 or 30
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.