https://medium.com/swlh/java-passing-by-value-or-passing-by-reference-c75e312069ed
public class ReferenceTest {
private void quoteTest1() {
ListNode l =new ListNode(2);
ListNode temp = l;
for (int i =0; i <6; i++) {
l.next =new ListNode(1);
l = l.next;
}
System.out.println("temp is:" + temp);
System.out.println("l is:" + l);
}
public static void main(String[] args) {
new ReferenceTest().quoteTest1();
}
}
https://blog.csdn.net/anLA_/article/details/78110948
关键点:就是要明白,左边栈里的这些变量全部,是复制原来的变量,这些变量目前指向了相同的内存地址;每个变量指向了不同的内存地址后,他们如何被修改,已经和原来的么关系了!