题目内容

下列程序结果是什么?()classFoo{publicstaticvoidmain(String[]args){intx=O;inty=4;for(intz=0;z<3;z++,x++){if(x>1 &++y<10)y++;}System.out.println(y);}}

A. 8
B. 7
C. 10
D. 12

查看答案
更多问题

阅读下面的代码:public class Example {public static void main(String[] args) {int[] arr = { 4, 1, 6, 3, 9, 8 };// 定义一个数组int minIndex = 0;//初始时设第1个角标处的值为最小值for (int i = 1; i < arr.length; i++) {if (_____________) {minIndex = i;}}System.out.println("数组中的最小值为:"+arr[minIndex]);}}如果要计算数组中的最小值,那么上述代码的横线处应该填写()

A. i
B. arr[i]
C. arr[i]>arr[minIndex]
D. i>minIndex

请阅读下面的程序 public class Test { public static void main(String[] args) { int a = {2,0,4,1,8,3,5}; int temp; for (int i = 0; i < a.length - 1; i++) { for (int j = a.length - 1; j > i; j--) { if (aj < aj - 1) { temp = aj; aj = aj - 1; aj - 1 = temp; } } } for (Integer i : a) { System.out.println(i); } }}下列选项中,哪一个是程序的运行结果。( )

A. 8
B. 5
C. 4
D. 3

请阅读下面的程序 public class Test { public static void main(String[] args) { int a = { 2, 0, 4, 1, 8, 3, 5 }; int temp; for (int i = 0; i < a.length - 1; i++) { for (int j = a.length - 1; j > i; j--) { if (aj < aj - 1) { temp = aj; aj = aj - 1; aj - 1 = temp; } }} for (Integer i : a) { System.out.print(i); } }} 下列选项中,哪个是程序的运行结果()

A. 8543210
B. 0123458
C. 2041835
D. 以上答案都不对

下列选项中,哪些可以作为if语句的判断条件( )

A. x>1&&x<5
B. x>1||x<5
C. x==3||x==4
D. x=3&&x=4

答案查题题库