博客
关于我
教妹学Java(十四):switch 语句详解
阅读量:107 次
发布时间: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/

你可能感兴趣的文章
python列表去重复后按照顺序_从包含不可共元素的Python列表中删除重复元素,同时保留顺序?...
查看>>
python列表前几个_python之列表
查看>>
python列表元组
查看>>
Python列表/元组/字典和集合使用
查看>>
python列表 行列选择_python_pandas_dataframe_行列选择_切片操作
查看>>
python列表
查看>>
python列出当前目录、子目录和文件的脚本
查看>>
python+flask计算机毕业设计骨科门诊患者档案管理系统(程序+开题+论文)
查看>>
python+flask计算机毕业设计高校体测管理系统的设计与实现(程序+开题+论文)
查看>>
Python切片对象和__getitem__
查看>>
python+flask计算机毕业设计高校体育竞赛成绩管理系统的设计与实现(程序+开题+论文)
查看>>
python+flask计算机毕业设计高校体育赛事系统(程序+开题+论文)
查看>>
python+flask计算机毕业设计高校体育运动会比赛系统(程序+开题+论文)
查看>>
python+flask计算机毕业设计高校危化品管理系统(程序+开题+论文)
查看>>
python+flask计算机毕业设计高校团委事务管理系统(程序+开题+论文)
查看>>
Python切片(%s)
查看>>
python+flask计算机毕业设计高校学生选课系统(程序+开题+论文)
查看>>
python+flask计算机毕业设计高校学生饮食推荐系统(程序+开题+论文)
查看>>
python+flask计算机毕业设计高校教务管理系统(程序+开题+论文)
查看>>
python+flask计算机毕业设计高校教学档案管理系统(程序+开题+论文)
查看>>