题目内容

请阅读下面的程序 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

本题的功能是计算二维数组arr[][]={{34,21,45,67,20),{23,10,3,45,76},{22,3,79,56,50}}中的最小值,并输出。public class Demo1 {public static void main(String[] args) {int arr[][] = { {34, 21, 45, 67, 20 }, {23, 10, 3, 45, 76 }, { 22, 3, 79, 56, 50 } };int i = 0;int j = 0;int min = arr[0][0];while (i < 3) {while ( (1) ) {if (arr[i][j] < min)min = arr[i][j];j++;}(2) ;(3) ;}System.out.println("The min:" + min);}}

当if语句只控制一行执行语句时,可以不写后面的大括号

A. 对
B. 错

答案查题题库