- public class StringBufferDemo {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- StringBuffer sb=new StringBuffer();
- StringBuffer sb1=sb.append(25);
- show(sb.toString());
- show(sb1.toString());//sb中没有25,而sb1中有25,他们怎么会相等呢?
- }
- public static void show(String str){
- System.out.println(str);
- }
- }
复制代码
|