public class ParamTest
{
public void change(Person person,Person person)
{
person.name = "张三";
person2.name = "李四";
}
public static void main(String[] args)
{
Person person = new Person();
person.name = "王五";
Person person2 = person;
ParamTest test = new ParamTest();
test.change(person,person2);
System.out.println(person.name);
}
}
为什么 最后的结果会是 李四呢? 求解 |
|