hyderman
Posts: 11
Nickname: salem99
Registered: Oct, 2002
|
|
Re: do while help
|
Posted: Jul 7, 2004 10:23 AM
|
|
thanx for replying, actually still giving me running errors
public int find (int value) { int counter = 0; Node tempNode = root; do{ counter++; if (value == tempNode.getValue() ) { this.current = tempNode; return counter; } else if (value < tempNode.getValue() ) { tempNode = tempNode.getLeft(); //this.current = tempNode; } else { tempNode = tempNode.getRight(); //this.current = tempNode; } } //current = null; while (tempNode != null);
return -1 * counter; }
i am not sure where is the error here, i must use either do while or for loop, i tried several ways and still running error, it compiles but it gives running errors
message: "exception in thread "main" java.lang.NullPointerException"
|
|