- package com.entel.demo;
- public class TestSwitch {
- public static void switchMethod(String demo) {
- switch (demo) {
- case "ZhangSan":
- System.out.println("ZhangSan come here");
- break;
- case "LiJian":
- // System.out.println("LiJian come here");
- break;
- case "LiSi":
- System.out.println("LiSi come here");
- break;
- default:
- break;
- }
- }
JDK7支持switch中使用String
最新推荐文章于 2021-02-25 05:10:18 发布