The following code:
public boolean find(MusbachJ_Person person,BstNode node)
{
//p.l(person);p.l(node.intData);
if(node.intData.compareTo(person)==0)
{
return true;
}
if( node.leftNode != null ) find(person,node.leftNode );
if( node.rightNode != null ) find( person, node.rightNode);
else
{
return false;
}
}
returns the following compilation error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
This method must return a result of type boolean
at MusbachJ_TreeNode.find(MusbachJ_TreeNode.java:32)
at MusbachJ_PeopleTree.main(MusbachJ_PeopleTree.java:91)
But I don't understand, the else statement is right there, what more does it want? Thanks! :)