/**
* @author Will.Wang
* @date 2018年2月6日
*/
public class Test {
public static void change(String s, int i, StringBuffer sb, Person p) {
System.out.println("----------开始----------");
s = "123";
System.out.println(s);
i = 3;
System.out.println(i);
p.setAge(100);
System.out.println(p.toString());
p = new Person("bb", 44);
System.out.println(p.toString());
sb.append("woshi");
System.out.println(sb.toString());
sb = new StringBuffer("sbsb");
System.out.println(sb.toString());
System.out.println("----------结束----------");
}
public static void main(String[] args) {
String s = "aaa";
int i = 1;
i = 2;
StringBuffer sb = new StringBuffer("buff");
Person p = new Person("aa", 12);
System.out.println(s);
System.out.println(i);
System.out.println(sb.toString());
System.out.println(p.toString());
change(s, i, sb, p);
// s="222";
System.out.println(s);
System.out.println(i);
System.out.println(sb.toString());
System.out.println(p.toString());
}
//结果
// aaa
// 2
// buff
// Person [name=aa, age=12]
// ----------开始----------
// 123
// 3
// Person [name=aa, age=100]
// Person [name=bb, age=44]
// buffwoshi
// sbsb
// ----------结束----------
// aaa
// 2
// buffwoshi
// Person [name=aa, age=100]
}
网友评论