My java code doesn't work?
-
The problem is the first line if (toBeRemoved.left = null || toBeRemoved.right = null) { Node newChild; if (toBeRemoved.left = null) newChild = toBeRemoved.right; else newChild = toBeRemoved.left; if (parent == null) root = newChild; else if (parent.left == toBeRemoved) parent.left = newChild; else parent.right = newChild; return; } that is the code, here is the error message: operator || cannot be applied to <nulltype>,Node
-
Answer:
You need 2 equals signs: if (toBeRemoved.left = null || toBeRemoved.right = null) should be if (toBeRemoved.left == null || toBeRemoved.right == null) One equals is for assignment, 2 for comparison.
outbakse... at Yahoo! Answers Visit the source
Other answers
In the first line, try using == instead of =, so the it looks like this: if (toBeRemoved.left == null || toBeRemoved.right == null)
justgenius12
Related Q & A:
- How come CD doesn't work in my shell script?Best solution by Super User
- Youtube doesn't work on iphone?Best solution by answers.yahoo.com
- Google doesn't work (google.com) on any computer?Best solution by Yahoo! Answers
- Yahoo Music Doesn't Work?Best solution by Yahoo! Answers
- Mail search doesn't work?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.