博客
关于我
教妹学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实现建造者模式(附完整源码)
查看>>
Objective-C实现开方数(附完整源码)
查看>>
Objective-C实现异或加密(附完整源码)
查看>>
Objective-C实现异或加密(附完整源码)
查看>>
Objective-C实现异或密码算法(附完整源码)
查看>>
Objective-C实现异步编程(附完整源码)
查看>>