博客
关于我
教妹学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实现图-弗洛伊德FloydWarshall算法(附完整源码)
查看>>
Objective-C实现图书借阅系统(附完整源码)
查看>>
Objective-C实现图像二维熵的图像信号丢失检测(附完整源码)
查看>>
Objective-C实现图像去雾算法(附完整源码)
查看>>
Objective-C实现图像灰度变换(附完整源码)
查看>>
Objective-C实现图像移动(附完整源码)
查看>>
Objective-C实现图层混合算法(附完整源码)
查看>>
Objective-C实现图片erosion operation侵蚀操作算法(附完整源码)
查看>>
Objective-C实现图片的放大缩小(附完整源码)
查看>>
Objective-C实现图片腐蚀(附完整源码)
查看>>
Objective-C实现图片膨胀(附完整源码)
查看>>
Objective-C实现图的邻接矩阵(附完整源码)
查看>>
Objective-C实现圆球的表面积和体积(附完整源码)
查看>>
Objective-C实现在Regex的帮助下检查字谜算法(附完整源码)
查看>>
Objective-C实现均值滤波(附完整源码)
查看>>
Objective-C实现埃拉托斯特尼筛法算法(附完整源码)
查看>>
Objective-C实现域名解析(附完整源码)
查看>>
Objective-C实现域名转IP(附完整源码)
查看>>
Objective-C实现培根密码算法(附完整源码)
查看>>
Objective-C实现基于 LIFO的堆栈算法(附完整源码)
查看>>