Reputation: 45
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. I am probably declaring something wrong.
Upvotes: 1
Views: 2363
Reputation: 73528
You're creating a BinaryTreeNode
, then throwing it away instantly (with temp = left;
). The IDE is warning you about whether you really intend to do that.
You could use null instead, or assign left
directly to temp
.
Upvotes: 5