?? capacity.java
字號:
//capacity.Java
import javax.swing.*;
public class capacity {
// test StringBuffer methods for capacity and length
public static void main( String args[] )
{
StringBuffer buffer = new StringBuffer( "Hello, how are you?" );
String output = "buffer = " + buffer.toString() +
"\nlength = " + buffer.length() + "\ncapacity = " + buffer.capacity();
buffer.ensureCapacity( 69 );
output += "\n\nNew capacity = " + buffer.capacity();
buffer.setLength( 10 );
output += "\n\nNew length = " + buffer.length() +
"\nbuf = " + buffer.toString();
JOptionPane.showMessageDialog( null, output,
"StringBuffer length and capacity Methods",
JOptionPane.INFORMATION_MESSAGE );
System.exit( 0 );
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -