看不清
√十天内免登录忘记密码?
还没账号?马上注册
推荐这样写:
default
在Switch语句使用枚举类型的时候,如果使用了default分支,在将来就无法通过编译器来检查新增的枚举类型了。
Switch
全部评分
总计:赞0次
spring
谢谢楼主分享
K哥馆
最后发贴: 2024-10-21 23:09
一个高大上的名字
最后发贴: 2016-03-18 20:26
课课家运营团队
最后发贴: 2021-11-01 22:54
起个名字你猜我叫啥
最后发贴: 2016-03-08 22:23
一路风景都看透
最后发贴: 2016-03-08 22:18
论坛站务软件水平考试华为认证计算机等级PMP认证思科认证Photoshop3DMAX编程语言移动开发系统运维产品运营淘宝营销办公软件Ps修图云计算大数据摄影就业
<h2 style="border: 0px; margin: 0px 0px 20px; padding: 0px; font-size: 24px; font-stretch: normal; line-height: 36px; font-family: "Microsoft YaHei", "Myriad Pro", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; color: rgb(46, 46, 46); white-space: normal; background-color: rgb(255, 255, 255);"> Switch语句</h2><h3 style="border: 0px; margin: 0px 0px 20px; padding: 0px; font-size: 20px; font-stretch: normal; line-height: 30px; font-family: "Microsoft YaHei", "Myriad Pro", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; color: rgb(46, 46, 46); white-space: normal; background-color: rgb(255, 255, 255);"> ①、每个分支都必须用大括号括起来</h3><p style="border: 0px; margin-top: 0px; margin-bottom: 20px; padding: 0px; font-size: 15px; color: rgb(46, 46, 46); font-family: "Microsoft YaHei", 宋体, "Myriad Pro", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);"> 推荐这样写:</p><p><img src="/Public/forum/ueditor/image/20171017/1508203337787059.png" title="1508203337787059.png" alt="image.png"/></p><h3 style="border: 0px; margin: 0px 0px 20px; padding: 0px; font-size: 20px; font-stretch: normal; line-height: 30px; font-family: "Microsoft YaHei", "Myriad Pro", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; color: rgb(46, 46, 46); white-space: normal; background-color: rgb(255, 255, 255);"> ②、使用枚举类型时,不能有<code style="border: 0px; margin: 0px; padding: 0px; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;">default</code>分支, 除了使用枚举类型以外,都必须有<code style="border: 0px; margin: 0px; padding: 0px; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;">default</code>分支</h3><p><img src="/Public/forum/ueditor/image/20171017/1508203412103821.png" title="1508203412103821.png" alt="image.png"/></p><p><span style="color: rgb(46, 46, 46); font-family: "Microsoft YaHei", 宋体, "Myriad Pro", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);"> 在</span><code style="border: 0px; margin: 0px; padding: 0px; font-size: 15px; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; color: rgb(46, 46, 46); white-space: normal; background-color: rgb(255, 255, 255);">Switch</code><span style="color: rgb(46, 46, 46); font-family: "Microsoft YaHei", 宋体, "Myriad Pro", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">语句使用枚举类型的时候,如果使用了</span><code style="border: 0px; margin: 0px; padding: 0px; font-size: 15px; font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; color: rgb(46, 46, 46); white-space: normal; background-color: rgb(255, 255, 255);">default</code><span style="color: rgb(46, 46, 46); font-family: "Microsoft YaHei", 宋体, "Myriad Pro", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">分支,在将来就无法通过编译器来检查新增的枚举类型了。</span><br/></p>