题目内容

下列哪条语句能创建一个具有3个初始值为“”的元素的字符串数组

A. String strList[3]("");
B. String[3] strList={"","",""};
C. String[] strList={"","",""};
D. String[3] strList=new String[3];

查看答案
更多问题

下面的语句创建了( )个String对象String[] strArray=new String[]{"a","b","c","d","e"};

A. 5
B. 6
C. 7
D. 8

有如下定义:int[] x=new int[]{0,2,4,4,5,6,7,8,9,10};则数组x在内存中所占的字节数是

A. 10
B. 20
C. 40
D. 80

下列程序的输出结果是public static void main(string[] args){int[] x = { 22, 33, 44, 55, 77, 88,99 };int k, y = 0;for (k = 1; k <= 4; k++)if (x[k] % 2 == 1)y++;System.out.println(y);}

A. 0
B. 1
C. 2
D. 3

下列程序的输出结果是( )public static void main(String[] args){int k=5;int[] a = new int[10];int[] p=new int[3];for (int i = 0; i < 10; i++)a[i] = i;for (int i = 0; i < 3; i++)p[i] = a[i * (i + 1)];for (int i = 0; i < 3; i++)k += p[i] * 2;System.out.println(k);}

A. 20
B. 21
C. 22
D. 23

答案查题题库