博客
关于我
教妹学Java(十四):switch 语句详解
阅读量:105 次
发布时间:2019-02-25

本文共 2530 字,大约阅读时间需要 8 分钟。

?????Java???switch????

????????????????????????????????????????????????????Java??????????switch???

?????????????"switch??"????

???????????Java??switch????????????????????????????byte?short?int?long????????????Byte?Short?Integer??

????????????switch?????????

?????switch????????????????????????????????if-else?????????????????????????

?????????????????????C++??Python?if-else??????????switch???Java?????????

????????switch?????????Java??switch?????????????????????????????????????????????????

??????????????????????switch????

????????????????????????????????

int num = 5;switch (num) {case 1:System.out.println("?");break;case 2:System.out.println("?");break;default:System.out.println("??");break;}

???????????????if-else????????

???????????????????????switch?????????????????????????switch???????????if-else?????????????????????????????????

???????????switch????

??????????????????????????????switch?????????????????????????????????switch??????????????

???????????switch????????????????

????????????switch???case?????????????????????????case???????????????????

?????????????????????

?????????????????????case??????????

int num = 2;switch (num) {case 1:System.out.println("?");break;case 2:System.out.println("??");break;}

?????????????????????

??????????????????????????????switch????if-else????

?????????????????????????????????????????switch?????????????????????????switch??????

?????????????????????????????

????????????if-else???????????switch??????????????????

????switch?????????????????

??????????????????????????switch???case????????????case?????????????????????????

???????????????

???????????????????case????????

int num = 3;switch (num) {case 1 + 2:System.out.println("?");break;}

???????????case????????

???????????????????switch????

??????????switch????????????????????????????????case???????????switch???????????????????switch????if-else????????????????

????????????????switch????

????????????????????????????????????????

int month = 4;switch (month) {case 1:System.out.println("??");break;case 2:System.out.println("??");break;case 3:System.out.println("??");break;case 4:System.out.println("??");break;default:System.out.println("????");break;}

??????????????????????????????

????????switch??????????????????????????????????????????????switch???

??????????switch???if-else?????????

????????switch???????????????????????????switch??????????????if-else???????????????????????

?????????????switch??????????

???????????switch???????Java????????????????????????????switch??????????????????????switch???????????????????

转载地址:http://cg.baihongyu.com/

你可能感兴趣的文章
Objective-C实现雪花算法(附完整源码)
查看>>
Objective-C实现雪花飘落效果(附完整源码)
查看>>
Objective-C实现非丰富数之和算法(附完整源码)
查看>>
Objective-C实现非并行奇偶转置排序算法(附完整源码)
查看>>
Objective-C实现骑士旅游算法(附完整源码)
查看>>
Objective-C实现骑士旅游算法(附完整源码)
查看>>
Objective-C实现高斯-赛德尔迭代算法(附完整算法)
查看>>
Objective-C实现高斯消元法(附完整源码)
查看>>
Objective-C实现高斯消元法(附完整源码)
查看>>
Objective-C实现高斯消元算法(附完整源码)
查看>>
Objective-C实现高斯消去法(附完整源码)
查看>>
Objective-C实现高斯消除算法(附完整源码)
查看>>
Objective-C实现高斯滤波GaussianBlur函数用法(附完整源码)
查看>>
Objective-C实现高斯滤波函数(附完整源码)
查看>>
Objective-C实现高精度乘法(附完整源码)
查看>>
Objective-C实现高精度减法(附完整源码)
查看>>
Objective-C实现高精度除法(附完整源码)
查看>>
Objective-C实现鸡兔同笼问题(附完整源码)
查看>>
Objective-c正确的写法单身
查看>>
Objective-C语法之代码块(block)的使用
查看>>