- public class Test2 {
- public static void main(String[] args) {
- String a = "A";
- StringBuffer b = new StringBuffer("B");
- StringBuffer c = new StringBuffer("C");
- change(a,b,c);
- System.out.println(a+","+b+","+c);
- }
- public static void change(String s,StringBuffer s1,StringBuffer s2){
- s= s+"1";
- s1.append("1");
- s2 = new StringBuffer("C1");
- }
- }
复制代码 为何出的不是A1 B1 C?
a在调用S=S+”1“在内存中到底是怎么加载的?
|
|