问题:
public class SwitchTest {
public static void main(String[] args) {
System.out.println(“value = “ + switchIt(4));
}
public static int switchIt(int x) {
int j = 1;
switch (x) {
case 1: j++;
case 2: j++;
case 3: j++;
case 4: j++;
case 5: j++;
default: j++;
}
return j + x;
}
}
What is the result?()
A . value = 3
B . value = 4
C . value = 5
D . value = 6
E . value = 7
F . value = 8
public class SwitchTest {
public static void main(String[] args) {
System.out.println(“value = “ + switchIt(4));
}
public static int switchIt(int x) {
int j = 1;
switch (x) {
case 1: j++;
case 2: j++;
case 3: j++;
case 4: j++;
case 5: j++;
default: j++;
}
return j + x;
}
}
What is the result?()
● 参考解析
本题暂无解析