switch1.java
来自「java 教程源码」· Java 代码 · 共 33 行
JAVA
33 行
//c3:Switch1.java
// author:ZhangHongbin
//This program is protected by copyright laws.
//Test switch sentence.
public class Switch1
{
public static void main(String[] args)
{
int num=0;
int choice=1;
switch(choice)
{
case 1:
num=1;
System.out.println("choice=1");
break;
case 2:
num=2;
System.out.println("choice=2");
break;
case 3:
num=3;
System.out.println("choice=3");
break;
default:
num=4;
System.out.println("choice=default");
}
System.out.println("choice= "+choice+" num= "+num);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?