下列关于数组的静态初始化语句,正确的是( )
A: int
[] score =new int[]{1,2,3,4,5};
B: int
[] score=new int[5]{1,2,3,4,5};
C: int [5] score=new
int[]{1,2,3,4,5};
D: int [5] score=new
int[5]{1,2,3,4,5};
A: int
[] score =new int[]{1,2,3,4,5};
B: int
[] score=new int[5]{1,2,3,4,5};
C: int [5] score=new
int[]{1,2,3,4,5};
D: int [5] score=new
int[5]{1,2,3,4,5};
举一反三
- 以下( )代码,不能够对数组正确初始化(或者是默认初始化)。 A: int[] a; B: int[] a = new int[5]; C: int[] a = new int[5]{1, 2, 3, 4, 5}; D: int[] a = {1, 2, 3, 4, 5};
- 下面几条定义一维数组的语句,正确的是 A: int[] arr2 = new int[]; B: int[] arr2 = new int[5]; C: int arr2[] = new int[5]{1, 2, 3, 4, 5}; D: int[] arr2 = new int[5]{1, 2, 3, 4, 5, 6};
- 下列数组初始化正确的是:() A: int[5] a= {1,2,3,4,5}; B: int[2][2] a = {{1,2},{3,4}}; C: int[][] a = {{2,3,4,5},new int[3]}; D: int[][] a = new int[][5];
- 以下数组定义,正确的是( )。 A: int a[5]; B: int[] a = new [5]; C: int[] a = {1, 2, 3, 4, 5}; D: int a = new int[5];
- 以下的数组定义语句中,不正确的是() A: int[] a=new int[5]{1,2,3,4,5}; B: int[,] a=new int[3][4]; C: int[][] a=new int[3][]; D: int[] a={1,2,3,4,5};