為什么這樣會(huì)輸出四個(gè)結(jié)果,不是只有case1符合嗎而我另一個(gè)代碼public class HelloWorld {??? public static void main(String[] args) {?? ??? ?char today='日';?? ??? ?switch(today){?? ??? ???? case '一':?? ??? ???? case '三':?? ??? ???? case '五':?? ??? ???????? System.out.println("吃包子");?? ??? ???????? break;?? ??? ???? case '二':?? ??? ???? case '四':?? ??? ???? case '六':?? ??? ???????? System.out.println("吃油條");?? ??? ???????? break;?? ??? ???? case '日':?? ??? ???????? System.out.println("吃主席套餐");?? ??? ???????? break;?? ??? ???? default:?? ?? ??? ?}?}如果把break去掉,還是只會(huì)輸出 吃主席套餐
初學(xué)者 請(qǐng)問(wèn)switch語(yǔ)句中break怎么用
慕數(shù)據(jù)6005589
2018-06-18 17:56:14