0
這種方法給了我一個空指針異常,我不知道爲什麼,這是遞歸代碼有問題。我無法弄清楚。在recusive二叉樹方法上的Java空指針異常
public void clearAllSelections(){
//Recursively clear all the selections in the sub-tree of this node
//basis:
isSelected = false;
if(isLeaf()) return;
//recursion:
childrenRight.clearAllSelections();
childrenLeft.clearAllSelections();
}
childrenRight or childrenLeft is null。使用您的調試器來識別原因。 –