私はNullPointerException
列に並んでいます
GUI getText (tr.search(tr, txtFindf.getText().charAt(0),txtFindf.getText())
そして等号線で。私のプログラムは二分木実装です:
public class BTree {
private char value;
private BTree left;
private BTree right;
private String indent;
private boolean cheak;
private String searchres;
public BTree pushInTree (BTree node,char leter,String word) {
if(node == null){
node = new BTree();
node.value = leter;
node.indent = word;
return node;
}
else
if (node.value > leter) node.left = pushInTree(node.left, leter, word);
else node.right = pushInTree(node.right, leter, word);
return node;
}
public void output(BTree node) {
if (node == null) return;
System.out.println(node.indent+"");
if (node.left != null ) output(node.left);
if (node.right != null ) output(node.right);
}
public void output2(BTree node) {
System.out.print(node.value+" ");
if (node.left != null ) output2(node.left);
if (node.right != null ) output2(node.right);
}
public boolean search (BTree node,char leter,String word){
if (node == null)return cheak;
if (node.indent.equals(word)){ \\error here !!!
cheak=true;
searchres = node.indent;
}
if (node.value > leter) search(node.left, leter,word);
else search(node.right, leter,word);
return cheak;
}
public String result() {
return searchres;
}
}