我有两个实例变量,head 和 tail。在代码中有一行:
head = tail = new Node<E>();
这是否意味着类 Node 有两个实例,head 和 tail?我在这里很困惑。
最佳答案
简单的意思是:
tail = new Node<E>();
head = tail;
所以有 2 个引用(head
和 tail
)指向同一个 Node<E>
实例。
关于java,两个对象,object1 = object2 = class/type ...没看懂,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13632750/