请阅读下面的程序 public class Test { public static void main(String[] args) { for(int x =0;x<5;x++){ if(x%2==0) break; System.out.println(x); } } } 运行结果正确的是()
A. 12345
B. 024
C. 13
D. 不输出任何内容
查看答案
请阅读下面的程序 public class Test { public static void main(String args) { int i = 0; int count = 0; do { if (!(i + "").contains("4")) { count++; } i++; } while (i < 500); System.out.println("一共有:" + count); } }下列选项中,哪一个是程序运行后count的值( )
A. 322
B. 323
C. 324
D. 325
下列程序结果是什么?()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