您的位置:首页 > 其它

文章标题

2016-09-18 23:01 295 查看
package com.bb;

public class Demo1 {

/**

* @param args

* Java的switch的运用

*/

public static void main(String[] args) {

int num=2;

switch(num){

case 1:

System.out.println(“111”);

break;

case 2:

System.out.println(“23”);

break;

case 5:

System.out.println(“344”);

break;

}

int i=22;

switch(i)

{ case 1:System.out.println(“you are the first!”);

case 2:System.out.println(“you are the second!”);

case 3:System.out.println(“you are the third!”); break;

default:System.out.println(“you are the last!”);

}

int a = 1;

switch (a) {

case 2:

System.out.println(“In case 2”);

break;

case 3:

System.out.println(“In case 3”);

break;

default:

System.out.println(“In default”);

break;

case 1:

System.out.println(“In case 1”);

break;

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: