Java常用API知识测试带答案.docVIP

  • 23
  • 0
  • 约6.72千字
  • 约 16页
  • 2019-06-01 发布于浙江
  • 举报
常用API部分测试题 String类中的getBytes()方法的作用是( C ) 将整数变成字符串 将字符串变成字符数组 将字符串变成字节数组 获取字符串中字符的个数 下列程序的输出结果是( A ) class Demo { publicstaticvoid main(String[] args) { System.out.println(abcd.substring(1,3)); } } bc 包头不包尾 b bcd abcd 对字符串”ababcdabcdefg”使用indexOf(‘a’)和lastIndexOf(‘a’),的运行结果是( B ) 1,1 0,6 0,0 1,6 indexOf 从前开始获取,第一位是0 lastIndexOf 从后开始获取,但索引还是从前面的第一位0开始 下面程序的运行结果是什么( A ) public static void main(String[] args){ String s1 = “abc”; String s2 = “xyz”; show(s1,s2); System.out.println(s1+”-----”+s2); } static void show(String s1,String s2){ s1 = s2+s1+”Q”; show方法中的s1= “xyzabcQ”但

文档评论(0)

1亿VIP精品文档

相关文档