首页 > 其他 > 详细

switch留个爪,之后还需要再研究下

时间:2019-03-05 23:05:48      阅读:190      评论:0      收藏:0      [点我收藏+]
技术分享图片
 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

 

switch留个爪,之后还需要再研究下

原文:https://www.cnblogs.com/allison-aichipingguo/p/10480265.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!