题目内容

下列程序的运行结果是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

下列程序的运行结果是public class Test{public static void changeStr(String str){str="welcome";}public static void main(String[] args){String str="1234";changeStr(str);System.out.println(str);}}

A. welcome
B. welcome1234
C. 1234welcome
D. 1234

答案查题题库