AP计算机教程3-6:简单多选题
0:00
Given the following code segment, what is in the string referenced by s1
?
String s1 = "xy"; String s2 = s1; s1 = s1 + s2 + "z";
把两个
s1
和z
连接起来,注意中间没有空格。2
What is the value of len
after the following executes?
String s1 = "Hey, buddy!"; int len = s1.length();
共有11个字符,注意空格也算在内。
3
What is the value of pos
after the following code executes?
String s1 = "ac ded ca"; int pos = s1.indexOf("d");
注意位置从0开始计算。
1
What is the value of s1
after the following code executes?
String s1 = "Hey"; String s2 = s1.substring(0,1); String s3 = s2.toLowerCase();
无论之后进行什么操作,只要
s1
没有被另赋新值,其内容始终不变。1
0 条评论