📄 strbuffer.java
字号:
//演示 StringBuffer 类方法的使用。
public class StrBuffer {
public static void main(String[] args) {
//自动产生的方法
StringBuffer s1 = new StringBuffer();
StringBuffer s2 = new StringBuffer(8);
StringBuffer s3 = new StringBuffer("StringBuffer");
System.out.println("s1 = new StringBuffer(),the capacity is--"+
s1.capacity());
System.out.println("s2 = new StringBuffer(8),the length is--"+
s2.length()+"\nThe capacity is --"+s2.capacity());
System.out.println("s3 = new StringBuffer(\"StringBuffer\")"+
"s3="+s3+" The length is--"+s3.length()+
"\nThe capacity is ---"+s3.capacity());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -