3.上海郊区某家公司自己眼瞎做错的题
switch。。。case
public static void main(String[] args) { int result = 0; int i = 2; switch (i) { case 1: result = result + i; //i为2,此处不运行 System.out.println(" "+result); //不输出 case 2: result = result + i * 2;//4 result=0+2*2=4 System.out.println(" "+result); case 3: result = result + i * 3;//10 result=4+2*3=10 } System.out.println(result); }
输出
4
10
signature:祸兮福所倚,福兮祸所伏