Change insert to :
private Node insert(Node node, int data) {
if (node == null) {
node = new Node(data);
}
else {
if (data <= node.data) {
node.left = insert(node.left, data);
}
else {
node.right = insert(node.right, data);
}
}
return (node);
}
In eclipse : Press Ctrl + a and then Ctrl+shift+f to format code.. you will get to know such errors easily…
solved Syntax error on eclipse [closed]