java之switch

勿在浮沙築高臺LS發表於2016-12-16
package switchleaning;

public class TestSwitch {
    public static void main(String[] args) {
        int i = 1;
        switch (i) {
        case 1:
        case 2:
        case 3:
        case 4:
            System.out.println(4);
        case 5:
            System.out.println(5);
        }
    }
}

實驗結果:

4
5

相關文章