第三章单元测试
  1. 在Java中,以下哪个选项正确地声明了一个字符串变量并初始化为“Hello, World!”?( )

  2. 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.
  3. 在Java中,以下哪个选项可以用来获取字符串的长度?( )

  4. A:str.getLength(); B:str.count(); C:str.size(); D:str.length();
  5. 在Java中,以下哪个选项是用来连接(拼接)两个字符串的?( )

  6. A:str1.concat(str2); B:str1.append(str2); C:Both A and B are correct. D:str1 + str2;
  7. 在Java中,以下哪个数组声明是正确的?( )

  8. 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];
  9. 在Java中,如何访问数组中的特定元素?( )

  10. A:array.index(element); B:array[index]; C:array.elementAt(index); D:array.get(index);

温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!
点赞(1) dxwkbang
返回
顶部