[英]The assigned value is never used - Java
In my code I have the following lines: 在我的代码中,我有以下几行:
BinaryTreeNode temp = new BinaryTreeNode();
temp = left;
while(temp != null)
temp = temp.left;
temp.left = newNode;
My IDE now says that: "the assigned value is never used" on the first line. 我的IDE现在说:第一行“从未使用分配的值”。 I am probably declaring something wrong.
我可能在声明错误。
You're creating a BinaryTreeNode
, then throwing it away instantly (with temp = left;
). 您正在创建
BinaryTreeNode
,然后立即将其丢弃(使用temp = left;
)。 The IDE is warning you about whether you really intend to do that. IDE向您警告您是否真的打算这样做。
You could use null instead, or assign left
directly to temp
. 您可以改用null,也可以直接将
left
分配给temp
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.