Each time I run it, I get a NullPointerException
.
public StrongBuilder inorder() {
return inorder(root);
}
private StringBuilder inorder(Node root) {
StringBuilder val;
if (root != null) {
inorder(root.getLeft())
}
val = new StringBuilder().append(root.getValue().getAccountNumber()).append(root.getValue().getName());
inorder(root.getRight());
return val;
}
Can anyone help spot the error for me? Thanks.