请看下列代码public class Num {public static void main(String[] args) {go();}public static void go() {String o = "";for (int x = 0; x < 3; x++) {for (int y = 0; y < 2; y++) {if (x == 1)break;if (x == 2 && y == 1)break;o = o + x + y;}}System.out.println(o);}}
A. 00
B. 0001
C. 000120
D. 00012021
查看答案
public class Num {public static void main(String[] args) {int x = 3;int y = 5;go(x, y);System.out.printf("x=%d,y=%d", x, y);}protected static void go(int num1, int num2) {if (num1 > num2) {num1 *= 2;} else {num2 += 5;}}}
A. x=3,y=5
B. x=3,y=10
C. x=6,y=5
D. x=6,y=10
下列代码的运行结果为:()public class Num {public static void main(String[] args) {int[] arr={3,5};go(arr);for(int i:arr){System.out.print(i+" ");}}protected static void go(int[] num) {if (num[0] > num[1]) {num[0] *= 2;} else {num[1] += 5;}}}
A. 3 5
B. 3 10
C. 6 5
D. 0 1
下列代码的运行结果是()public class NumOfEgg {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;}}
A. value =5
B. value =6
C. value =7
D. value =8
为了区分类中重载的同名不同方法,要求( )
A. 参数的类型或个数不同
B. 使用不同的参数名
C. 修改访问权限
D. 方法返回值数据类型不同