本帖最后由 .Mr 于 2013-12-5 11:05 编辑
对于下面的代码 通过运行的结果为hellojava.......java
s2我能够理解
s1=s2混乱了我的思路,我想问它其中的原理
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);
}
private static void show(StringBuilder s1, StringBuilder s2) {
s1.append(s2);
s1 = s2;
}
}
|