[填空题] 本题提取字符串“china is a great country.”中的前5个字符生成一个新的字符串,并将剩余字符组成另外一个新的字符串,最后将两个新的字符串连接输出。
public class java1
public static void main(String[] args)
String str="China is a great country.";
headstr=str. substring(______);
trailstr=str. substring(______);
System. out. println(headstr+trailstr)
参考答案:
第A处:String headstr, trailstr 第B处:0,E 第C处:E,str. length()-A问题解析:
第1处声明两个Sting类型的变量headstr和trailstr;第2处从str中的初始位置开始截取长度为5的子串;第3处从str第6个字符的地址开始向后截取比str长度小1的子串。

![[填空题] 本题提取字符串“china is a great country.”中的前5个字符生成一个新的字符串,并将剩余字符组成另外一个新的字符串,最后将两个新的字符串连接输出。 public c [填空题] 本题提取字符串“china is a great country.”中的前5个字符生成一个新的字符串,并将剩余字符组成另外一个新的字符串,最后将两个新的字符串连接输出。 public c](http://www.mshxw.com/aiimages/31/258450.png)
