public class Test7 { public static void main(String[] args) { int i=5; switch(i) { case 1: System.out.println("one"); case 10: System.out.println("ten"); case 5: System.out.println("five"); case 3: System.out.println("three"); default: System.out.println("other"); } }}复制代码è 结果是:
fivethreeother 复制代码switch(表达式)
{
case 常量表达式1:语句1;
....
case 常量表达式2:语句2;
default:语句;
}
转载于:https://www.cnblogs.com/RAOZHAOYANG/p/6849876.html