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
原文地址:https://www.cnblogs.com/allison-aichipingguo/p/10480265.html