下面代码运行后,变量sum的值是多少int[][] square = new int[3][3];for(int i=0;i<3;i++){square[i][i] =5;}int sum =0;for(int i=0;i<3;i++){for(int j=0;j<3;j++){sum += square[i][j] ;}}
查看答案
下列程序段的运行结果为int [][]x ={{1,2},{3,4,5},{6,7,8,9}};int[][]y = x;System.out.println(y[2][1]);
A. 3
B. 4
C. 6
D. 7
选择声明并创建数组的正确形式
A. int[] array;array[] = new int[15];
B. int[] array;array = new int[15];
C. int[15] array = new int[];
D. int[] array = new int[];
执行下列程序段后foo的值为String foo = "blue";boolean[] bar = new boolean[1];if(bar[0]){foo = "green";}System.out.println(foo);
A. ""
B. null
C. blue
D. green
下面代码的输出是()int x = 3;int[] numbers = new int[x + 2];x = 6;System.out.println(numbers.length);
A. 3
B. 5
C. 6
D. 8