请阅读下面的程序 public class Test { public static void main(String args) { int sum = 0; for (int i = 1; i <= 100; i++) { if (i % 2 == 0) { continue; } sum += i; } System.out.println(“sum = “ + sum); } }下列选项中,哪一个是程序的运行结果。( )
A. 1050
B. 2050
C. 2500
D. 以上答案都不对
查看答案
请阅读下面的程序 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