Hoping you guys can figure out why im getting a null pointer exception with what I can provide, the program has several classes and method but this is the one that is breaking.
public void search(Node node, String sData, int iData)
{
if (sData.equals(node.getString()) && (iData == node.getInt()))
{
System.out.println("Nailed it");
}else if (sData.compareTo(node.stringData) < 0)
{
search(node.left, sData, iData);
}else if (sData.compareTo(node.stringData) > 0)
{
search(node.right, sData, iData);
}
}
the Node that is getting input at first is the root and then it goes left or right from there through recursion, but the line that says its erroring is the if statement up top. Cannot figure out what is wrong sData is just a standard string input when the method is called and iData is just an int thats input as well. Cannot figure it out =/ thanks for any help