博客
关于我
教妹学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实现回调实例(附完整源码)
查看>>
Objective-C实现图-弗洛伊德FloydWarshall算法(附完整源码)
查看>>
Objective-C实现图书借阅系统(附完整源码)
查看>>