谁知道答案是多少?为什么?
谁知道答案是多少?为什么?package de;
public class TestStudent {
public static void main(String args[]) {
TestStudent ts = new TestStudent();
Student student = new Student();
student.setId(1);
student.setName("elong");
student.setClassId(1);
ts.change(student);
System.out.println(student);
}
public void change(Student student){
Student student2 = new Student();
student2.setId(2);
student2.setName("elongdeo");
student2.setClassId(2);
student.setId(3);
student.setName("dingyinlong");
student.setClassId(3);
student = student2;
student.setId(4);
student.setName("yinlong");
student.setClassId(4);
}
}