摘要:
在Java7之前,switch只能匹配整数值,和字符;而Java7添加了字符串的匹配特性。代码如下: 1 package blog; 2 3 4 public class Main { 5 public static void show(String str) { 6 switch (str) { 7 case "people": 8 System.out.println("Input string is people"); 9 break;10 case... 阅读全文