gpt4 book ai didi

java - Java 中的类引用

转载 作者:行者123 更新时间:2023-11-30 02:49:05 24 4
gpt4 key购买 nike

当我在解决方案中遇到以下几行时,我正在进行中序遍历:

stack.push(current);
current = current.left;

现在我的问题是,当我将 current 插入堆栈并使 current = current.left; 时,stack 中的节点也会更改为当前.left?就我而言,stack 中的 current 仍然指向原始 current,但 current 变量确实指向 current.left。这是为什么?

最佳答案

stack.push(current);

enter image description here

current = current.left;

enter image description here

关于java - Java 中的类引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39265170/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com