-
**在Java中, 以下选项中( ) 的数据可以存放在一个数组中. **
A."买羊肉串不?“,1,0
B.10,-2-,“30
C.true,6,8”
D.6,30,20 -
**在Java中, 已知定义数组int[] m = {0,1,2,3,4,5,6},以下选项中( ) 可以获得数组长度. **
A.m.length()
B.m.length
C.m.length()+1
D.m.length+1 -
在Java中, 创建数组的代码正确的是( ) .
A.int[] ages=new int[1,2,3];
B.int ages=new int[]{1,2,3};
C.int ages[]={1,2,3,};
D.int[] ages=[1,2,3]; -
在Java中, 以下代码实现的功能是( ).
public class Test {
public static void main(String[] args) {
int[] scores=new int []{99,95,91,87,85};
int temp=scores[0];
for (int index=1;index<5;index++){
if (scores[index]<temp){
temp=scores[index];
}
}
System.out.println(temp);
}
}
A.求最大数
B.求最小数
C.找到数组最后一个元素
D.编译出错
- 在Java中, 以下代码的运行结果是( ).
public class Test {
public static void main(String[] args) {
int[] a=new int[3];
int[] b=new int[]{1,2,3,4,5};
a=b;
for (int i=0;i<b.length;i++){
System.out.print(a[i]+" ");
}
}
}
A.123
B.程序报错
C.12345
D.00000
- 在Java中, 符合二重循环的语法是( ) .
A.while(循环条件){
if (判断条件){
//代码块
}
}
B.while(循环条件){
//代码块
}
while(循环条件){
//代码块
}
c. if (判断条件){
for(循环条件){
//代码块
}
}
D.for(循环条件){
while(循环条件){
}
}
- 在Java中, 以下代码的运行结果是( ).
public static void main(String[] args) {
int j=0;
for (int i=1;i<=;i++){
j=1;
while (j<=i){
System.out.print(j);
j++;
}
System.out.println("\n");
}
}
A .*
**
***
****
B. ****
***
***
**
*
C.1
12
123
1234
D.1
22
333
4444
}
- 在Java中, 以下代码的运行结果是( ).
public static void main(String[] args) {
int count=0;
for (int i=3;i>0;i–){
for (int j=1;j<3;j++){
count++;
}
}
System.out.println(count);
}
A.6
B.7
C.8
D.9 - **在Java中, 以下说法正确的是( ). **
A.程序执行到break语句时一定会结束所有循环
B.程序执行到continue语句时会结束当前循环,即continue语句所在的循环
C.continue和break语句可以出现在同一个循环体
D.continue和break语句作用相同 - 在Java中, 以下代码的运行结果是( ).
public static void main(String[] args) {
int count=0;
for (int i =0;i<10;i++){
for (int j=0; j<10;j++){
if (j%2==0){
continue;
}if (j==7){
break;
}else {
count++;
}
}
}
System.out.println(whb);
}
}
A.20
B.30
C.40
D.50