码迷,mamicode.com
首页 > 其他好文 > 详细

switch02

时间:2021-01-08 11:21:00      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:demo   string   public   jdk7   def   static   表达式   ring   字符串   

package com.lyc.struct;

public class SwitchDemo02 {
public static void main(String[] args) {
String name = "史蒂夫";
//JDK7的新特性,表达式结果可以说字符串
//字符的本质还是数字


switch (name){
case "史蒂夫":
System.out.println("史蒂夫");
break;
case "张三":
System.out.println("张三");
break;
case "李四":
System.out.println("李四");
break;
case "王五":
System.out.println("王五");
break;
default:
System.out.println("未知");
}
}
}

switch02

标签:demo   string   public   jdk7   def   static   表达式   ring   字符串   

原文地址:https://www.cnblogs.com/liuyunche/p/14243054.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!