在运行时老是报错 Exception in thread "main" java.lang.NullPointerException at BST.put(BST.java:120) at BST.put(BST.java:113) at BST.SearchData(BST.java:422) at BST.main(BST.java:481) 搞不清楚哪里出问题了,请教请教。 SD类刚忘了给出了 import java.util.ArrayList;// 构造Student类 class SD {
Object one,two,three;
//Student的无参构造器 public SD(){}
//Student的有参构造器 public SD(Object one,Object two,Object three) { this.one=one; this.two=two; this.three=three; } //重写toString方法 public String toString(){ return"tom.kc.Student[name="+this.one+",age="+this.two+",classNum="+ this.three+"]"; } }
Exception in thread "main" java.lang.NullPointerException
at BST.put(BST.java:120)
at BST.put(BST.java:113)
at BST.SearchData(BST.java:422)
at BST.main(BST.java:481)
搞不清楚哪里出问题了,请教请教。
SD类刚忘了给出了
import java.util.ArrayList;// 构造Student类
class SD {
Object one,two,three;
//Student的无参构造器
public SD(){}
//Student的有参构造器
public SD(Object one,Object two,Object three)
{
this.one=one;
this.two=two;
this.three=three;
} //重写toString方法
public String toString(){
return"tom.kc.Student[name="+this.one+",age="+this.two+",classNum="+
this.three+"]";
}
}