标签:代码块 默认值 格式 崩溃 出现 int() 系统 lan double
public static void main(String[] args){
int count = 0;
for(int j = 0;j<3;j++) {
for(int i = 0;i<6;i++) {
count++;
}
}
System.out.println(count);
}
A: 12
B: 18
C: 6
D: 3
public class Test {
public static void main(String[] args) {
for(int i = 0; i < 2; i++){
for(int j = 0; j <= 2; j++){
System.out.print("*");
}
System.out.println();
}
}
}
A:
******
B:
***
***
C:
*
*
D:
****
public static void main(String [] args){
for (int i = 0; i < 1; i++) {
System.out.println("执行语句1");
for (int j = 0; j < 2; j++) {
System.out.println("执行语句2");
}
System.out.println("执行语句3");
}
}
A:
没有输出结果
B:
执行语句1
执行语句2
执行语句2
执行语句3
C:
执行语句1
执行语句2
执行语句3
D:
执行语句1
执行语句2
执行语句2
执行语句3
执行语句1
执行语句2
执行语句2
执行语句3
public static void main(String[] args) {
int sum=0;
for (int i = 1; i < 3; i++) {
for (int j = 1; j < 3; j++) {
sum+=i*j;
}
}
System.out.println("sum="+sum);
}
A: sum=3
B: sum=4
C: sum=9
D: sum=5
for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { System.out.println(i + "," + j); }}
A: 0,0 0,1 0,2 1,0 1,1 1,2 2,0 2,1 2,2B: 0,1 0,2 1,1 1,2 2,1 2,2C: 0,0 0,1 0,2 1,0 1,1 1,2D: 没有任何输出.
A: Random r = new Random(); r.nextInt(5) + 10;B: Random r = new Random(); r.nextInt(10) + 5;C: Random r = new Random(); r.nextInt(5) + 5;D: Random r = new Random(); r.nextInt(6) + 5;
A: public static void main(String[] args) { Random r = new Random(); int num = r.nextInt(40)+59; System.out.println(num); } B: public static void main(String[] args) { Random r = new Random(); int num = r.nextInt(99) + 1; System.out.println(num); }C: public static void main(String[] args) { Random r = new Random(); int num = r.nextInt(99); System.out.println(num); }D: public static void main(String[] args) { Random r = new Random(); int num = r.nextInt(100)-1; System.out.println(num); }
A: Random r = new Random(); int num = r.nextInt();B: Random r = new Random(); int num = r.nextInt(100);C: Random r = new Random(); int num = r.nextInt(100)+1;D: Random r = new Random(System.in); int num = r.nextInt(100+1);
A: Random r=new Random(); int num=r.nextInt(90)-50;B: Random r=new Random(); int num=r.nextInt(50)+40;C: Random r=new Random(); int num=r.nextInt(40)+50;D: Random r=new Random(); int num=r.nextInt(90)-40;
A. public static void main(String[] args) { Random r = new Random(); int num = r.nextInt(40)+60; System.out.println(num); }B. public static void main(String[] args) { Random r = new Random(); int num = r.nextInt(100); System.out.println(num); }C. public static void main(String[] args) { Random r = new Random(); int num = r.nextInt(99); System.out.println(num); }D. public static void main(String[] args) { Random r = new Random(); int num = r.nextInt(100)-30; System.out.println(num); }
A: int[] arr = new int[3]; B: int[] arr = new int[3]{11,22,33};C: int[] arr = {11,22,33}; D: long[] arr = new int[] {33,22,11};
A: int[] arr = new int[5];B: int[] arr; arr = new int[]{1,3,5};C: int[] arr={1,3,5};D: int[] arr; arr = {1,3,5};
A: int[] arr = {1,2,3,4,5,6};B: int[] arr = new int[3];C: int[] arr = new int[6]{1,2,3,4,5,6};D: int[] arr = new int[]{1,2,3,4,5,6};
A: int[] arr = new int[5];B: boolean[] arr = new boolean[]{true,false};C: double[] arr = {3.14,5.23,6.6};D: int[] arr4 = new int[4]{1,2,3,4};
A: int[] arr = new int[] {33,22,11};B: int[] arr = new int[4];C: double[] arr = new double[3]{5.2, 3.14, 6.18};D: int[] arr = {11,22,33};
public static void main(String[] args){ int[] arr = { 3,6,9,2,5,8 }; System.out.println(____________);}
A:arr[6]B:arr[2]C:arr[1]D:arr[0]
public static void main(String[] args) { int arr[] = {1, 3, 5, 7, 9}; System.out.println("结果是:"+arr[1]); System.out.println("结果是:"+arr[arr.length-1]);}
A: 结果是:1 结果是:9B: 结果是:1 结果是:7 C: 结果是:3 结果是:7 D: 结果是:3 结果是:9
A:
public static void main(String[] args){ int[] arr = {1,2,3}; int num = arr;}
B:
public static void main(String[] args){ int[] arr = {1,2,3}; int num = arr0;}
C:
public static void main(String[] args){ int[] arr = {1,2,3}; arr[1] = 5;}
D:
public static void main(String[] args){ int[] arr = {1,2,3}; arr.[0] = 2;}
public static void main(String[] args){ int[] arr = { 9, 5, 2, 7 }; System.out.println(_______);}
运行结果如下: 7横线处应该填写的内容是( )
A: arr[7]B: arr[3]C: arr[2]D: arr
A:
public class Demo{ public static void main(String[] args){ int[] arr = {10,20,30,40,50}; System.out.println(arr[5]); }}
B:
public class Demo{ public static void main(String[] args){ int[] arr = {10,20,30,40,50}; System.out.println(arr[1]); }}
C:
public class Demo{ public static void main(String[] args){ int[] arr = {10,20,30,40,50}; System.out.println(arr); }}
D:
public class Demo{ public static void main(String[] args){ int[] arr = {10,20,30,40,50}; int num = arr[3]; System.out.println(num); }}
A:
public class Demo{ public static void main(String[] args){ int[] arr = {1,2,3,4,5,6,7}; for (int i = 0; i <= arr.length; i++) { System.out.println(arr[i]); } }}
B:
public class Demo{ public static void main(String[] args){ int[] arr = {1,2,3,4,5,6,7}; for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]); } }}
C:
public class Demo{ public static void main(String[] args){ int[] arr = {1,2,3,4,5,6,7}; int i = 0; while(i < arr.length){ System.out.println(arr[i]); } }}
D:
public class Demo{ public static void main(String[] args){ int[] arr = {1,2,3,4,5,6,7}; for (int i = 0; ; i++) { System.out.println(arr[i]); } }}
public static void main(String[] args) { int arr[] = {1, 20, 3, 60, 8, 9}; for (int i = 0; i < ______________; i++) { System.out.println(______________); }}
A:
①arr.length-1②i
B:
①arr.length-1②arr[i]
C:
①arr.length②i
D:
①arr.length②arr[i]
public static void main(String[] args){ int[] arr = { 2,7,1,6,3 }; for( int i = 0 ; ____(1)____ ; i++ ){ System.out.println(____(2)____); }}
A:
(1)i<arr.length-1(2)arr[i]
B:
(1)i<=arr.length-1(2)arr
C:
(1)i<=arr.length-1(2)arr[i]
D:
(1)i<arr.length-1(2)arr
A.
public static void main(String[] args) { int[] arr = { 9, 5, 2, 7 }; for (int i = 0; i < arr.length-1; i++) { System.out.println(arr[i]); }}
B.
public static void main(String[] args) { int[] arr = { 9, 5, 2, 7 }; for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]); }}
C.
public static void main(String[] args) { int[] arr = { 9, 5, 2, 7 }; for (int i = 1; i < arr.length; i++) { System.out.println(arr[i]); }}
D.
public static void main(String[] args) { int[] arr = { 9, 5, 2, 7 }; for (int i = 0; i <= arr.length; i++) { System.out.println(arr[i]); }}
A:
int[] arr = {3,4,5};for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]);}
B:
int[] arr = {3,4,5};for (int i = 0; i < arr.length; i++) { int num = arr[i]; System.out.println(num);}
C:
int[] arr = {3,4,5};for (int i = 0; i < 3; i++) { int num = arr[i]; System.out.println(num);}
D:
int[] arr = {3,4,5};for (int i = 0; i <= 2; i++) { System.out.println(arr[i]);}
public static void main(String[] args){ int[] arr = new int[5]; System.out.println(arr[5]);}
A: 0B: 控制台没有任何显示C: NullPointerExceptionD: ArrayIndexOutOfBoundsException
public static void main(String[] args) { int[] arr = null; System.out.println("结果是:"+arr[0]);}
A: 结果是:0B: 结果是:nullC: 程序报错:NullPointerExceptionD: 程序报错:ArrayIndexOutOfBoundsException
A:
public class Demo{ public static void main(String[] args){ int[] arr = {1,2,3,4}; int i = arr[4]; }}
B:
public class Demo{ public static void main(String[] args){ int[] arr = null; int i = arr[0]; }}
C:
public class Demo{ public static void main(String[] args){ int[] arr = {1,2,3,4}; arr = new int[1]; int i = arr[2]; }}
D:
public class Demo{ public static void main(String[] args){ int[] arr = new int[5]; int i = arr[2]; }}
public static void main(String[] args){ int[] arr = { 2,7,-1,6,3 }; _____(1)______ for(int i=1;i<arr.length;i++){ if(___(2)____){ ___(3)____ } } System.out.println("最大值是:" + max);}
A:
(1)int max = 0;(2)arr[i]<max (3)arr[i] = max;
B:
(1)int max = 0;(2)arr[i] > max (3)max = arr[i];
C:
(1)int max = arr[0];(2)arr[i] > max (3)max = arr[i];
D:
(1)int max = arr[0];(2)arr[i] > max (3)arr[i] = max;
A、a(3)????????? B、a[3]???? C、a(2)????????? D、a[2]
A.?char?str[]="hello";?B.?char?str[100]="hello";?C.?char?str[]={‘h‘,‘e‘,‘l‘,‘l‘,‘o‘};??? D.?char?str[]={‘hello‘};?
A、栈????? B、队列?????? C、堆????? D、链表?
A、double --?0.0??????B、boolean--true???C、float--0.0??????????D、int--?0?
A、?int[]?a;? B、?a?=?{1,?2,?3,?4,?5};? C、?int[]?a?=?new?int[5]{1,?2,?3,?4,?5};?D、?int[]?a?=?new?int[5];?
A、中止程序?B、抛出异常??C、系统崩溃?D、直接跳过
标签:代码块 默认值 格式 崩溃 出现 int() 系统 lan double
原文地址:https://www.cnblogs.com/lvtiantian/p/14719022.html