?? buffertest2.java
字號:
class BufferTest2 {
public static void main(String[] args) {
// 自動產生
StringBuffer buffer= new StringBuffer("How are you?");
//display the information of capacity.
System.out.println("字符串容量是: "+buffer.capacity()+"。\n");
//display the information of length.
System.out.println("字符串的長度是"+buffer.length()+".\n");
//display the usage of setLength() method.
buffer.setLength(100000);
System.out.println("用過方法 setLength(1000) 后");
System.out.println("此時字符串的長度是: "+buffer.length()+"。");
buffer.setLength(4);
System.out.println("用過方法 setLength(4) 后");
System.out.println("此時長度是: "+ buffer.length()+"。");
//display the usage of charAt() method.
System.out.println("\n方法 charAt() 的使用。");
System.out.println("使用了 charAt(2):"+buffer.charAt(2)+" 。");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -