题目内容

请看下列代码:public int print(String msg){return 0;}print方法的使用正确的是:

A. int result=print(100);
B. String result=print(100);
C. int result=print("hello");
D. String result=print("hello");

查看答案
更多问题

请看下列代码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

答案查题题库