switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
来源:互联网 发布:jeewx商业版源码下载 编辑:程序博客网 时间:2024/05/20 23:34
在switch(expr1)中,expr1只能是一个整数表达式或者枚举常量,整数表达式可以是int基本类型或Integer包装类型,由于,byte,short,char都可以隐含转换为int,所以,这些类型以及这些类型的包装类型也是可以的。显然,long和String类型都不符合switch的语法规定,并且不能被隐式转换成int类型,所以,它们不能作用于swtich语句中。
另外由于在JDK7.0中引入了新特性,所以witch语句可以接收一个String类型的值,String可以作用在switch语句上。
public static void main(String[] args) {String str = "name";switch (str) {case "name":System.out.println("name");break;default:break;}}
0 0
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch 语句能否作用在 byte 上,能否作用在 long 上,能否作用在 String 上?
- 面试题:switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上
- switch语句能否作用在 byte 上,能否作用在 long 上,能否作用在 String 上?
- switch语句能否作用在 byte 上,能否作用在 long 上,能否作用在 String 上?
- switch能否作用在char上,能否作用在byte上,能否作用在string上?
- switch能否作用在byte、long、String上?
- Safe string concatenation
- Android实现一键复制粘贴,兼容低版本系统(api 11以下)
- Win10 Ubuntu14.04 双系统 开机提示 error:no such partition grub rescue
- html5缓存(二)localStorage
- shiro安全框架
- switch语句能否作用在byte上,能否作用在long上,能否作用在String上?
- android相关下载
- java中for方法执行的正确顺序
- 复习iOS沙盒目录结构解析
- java中 .currentTimeMillis的用法和含义
- 微信开放平台API开发资料
- JAVA基础笔记1--入门教程网址
- [OCLint] oclint-xcodebuild 使用手册
- spring aop切面编程基础实例