public class StringBuilderTest {
public static void main(String[] args) {
StringBuilder s1 = new StringBuilder("hello");
StringBuilder s2 = new StringBuilder("java");
show(s1,s2);
System.out.println(s1+"......."+s2);//hellojava.......java
}
private static void show(StringBuilder s1, StringBuilder s2) {
char[] chs ={'a','c','d','f'};
s1.append(s2);
s1 = s2;
System.out.println(s1);//java
System.out.println(s2);//java
System.out.println(s1+"......."+s2);//java.......java
}
} |
|