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

 

posted on 2019-03-05 22:26  空谈误国-实干兴邦  阅读(169)  评论(0编辑  收藏  举报