首页 > 其他 > 详细

switch case 的值

时间:2014-09-01 19:30:43      阅读:261      评论:0      收藏:0      [点我收藏+]

 switch(value), 这个value只能使用能够转int类型的类型。如 char String int  enum >>>  Only convertible int values, strings or enum variables are permitted

 case 必须和value的类型一致。

 

 

public class Test {
    public static final String x = "xx";
    
    public static void main(String [] args) {
        String value = "123";
        switch(value){
            case x : System.out.println("a");
        }
    }
}

 

switch case 的值

原文:http://www.cnblogs.com/shouwangzhe-/p/3949756.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!