📄 stringcopymodify.java
字号:
//例7.4
class StringCopyModify{
public static void main(String args[]){
String s = new String("Now we will show how to have a sub string.");
System.out.println("From String \"" + s + "\"");
System.out.println("the length of s is:"+s.length());
String sub1 = s.substring(20);
String sub2 = s.substring(0,20);
System.out.println(" get a sub string from index 19 to the end:" + sub1);
System.out.println("the length of sub1 is:"+sub1.length());
System.out.println(" get a sub string from index 0 to 19:" + sub2);
System.out.println("the length of sub2 is:"+sub2.length());
String cons = sub2.concat(sub1);
System.out.println(" concat two sub strings into one:"+cons);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -