learning java StringBuilder 类

时间:2021-02-26 13:19:46
        StringBuilder  s1 = new StringBuilder();

        s1.append("panzidong");
s1.insert(,"hong,");
s1.replace(,,"!");
s1.reverse(); System.out.println(s1);
System.out.println(s1);
System.out.println(s1.length());
System.out.println(s1.capacity());
s1.setLength();
System.out.println(s1);

output:

gnodiznap!gnoh
gnodiznap!gnoh gnod