switch留个爪,之后还需要再研究下
作者:互联网
1 public class SwitchDemo 2 { 3 public static void main (String [] args) 4 { 5 for(int i = 0; i < 10; i++) 6 { 7 char c = (char) (Math.random() * 26 + 'a'); 8 System.out.print (c + ": "); 9 switch (c) 10 { 11 case 'a': 12 case 'e': 13 case 'i': 14 case 'o': 15 case 'u': 16 System.out.println("vowel"); 17 break; 18 case 'y': 19 case 'w': 20 System.out.println("Sometimes a vowel"); 21 break; 22 default: 23 System.out.println("consonant");} 24 } 25 } 26 }View Code
标签:case,26,留个,之后,System,char,switch,println,out 来源: https://www.cnblogs.com/allison-aichipingguo/p/10480265.html