阅读下面的代码片段public static int add(int a,int b) {return a + b;}下列选项中,可以在main()方法中调用add()方法的是
A. int num = add(1.0,2.0);
B. int num = add(1,2);
C. int num = add(true,flase);
D. int num = add("1", "2");
分析如下语句,说法错误的是
A. break可用于跳出循环,当多层嵌套时,只用于跳出一层循环
B. break即可以出现在循环语句中也可以出现在switch语句中
C. continue可以用于跳出循环
D. continue不能出现在switch语句中
下列属于不合法Java标识符的是
A. _avaj
B. 5save
C. Avaj
D. $80
下面的代码用于对数组arr实现冒泡排序:for (int i = 0; i < arr.length - 1; i++) {boolean isSwap = false;空白处if (!isSwap)break;}下列选项中,空白处可以填入的代码是:
A. for (int j = arr.length - 1; j > i; j--) {if (arr[j] < arr[j - 1]) {int temp = arr[j];arr[j] = arr[j - 1];arr[j - 1] = temp;isSwap = true;}}
B. for (int j = arr.length - 1; j > 0; j--) { if (arr[j] < arr[j - 1]) {int temp = arr[j];arr[j] = arr[j - 1];arr[j - 1] = temp;isSwap = true;}}
C. for (int j = i + 1; j< arr.length; j++) { if (arr[j] < arr[j - 1]) {int temp = arr[j];arr[j] = arr[j - 1];arr[j - 1] = temp;isSwap = true;}}
D. for (int j = i; j< arr.length; j++) { if (arr[j] < arr[j - 1]) {int temp = arr[j];arr[j] = arr[j - 1];arr[j - 1] = temp;isSwap = true;}}