第三章单元测试
- 在Java中,以下哪个选项正确地声明了一个字符串变量并初始化为“Hello, World!”?( )
- 在Java中,以下哪个选项可以用来获取字符串的长度?( )
- 在Java中,以下哪个选项是用来连接(拼接)两个字符串的?( )
- 在Java中,以下哪个数组声明是正确的?( )
- 在Java中,如何访问数组中的特定元素?( )
A:String str = new String("Hello, World!"); B:Both A and C are correct. C:string str = "Hello, World!"; D:String str = "Hello, World!";
答案:Both A and C are correct.
A:str.getLength(); B:str.count(); C:str.size(); D:str.length();
A:str1.concat(str2); B:str1.append(str2); C:Both A and B are correct. D:str1 + str2;
A:int[] array = {1, 2, 3, 4, 5}; B:Both A and C are correct. C:int array[] = new int(5); D:int[] array = new int[5];
A:array.index(element); B:array[index]; C:array.elementAt(index); D:array.get(index);
温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!