为什么代码会抛出空指针异常以及使用'this'的含义是什么。我是初学者,重视任何帮助。在下列情况下使用关键字'this'有什么用处暗示
// class Foobar
private Foo f;
void get(){
this.getFoo().handle();
}
public Foolish getFoo(){
return this.f;
}
void handle(){
System.out.println("handle of the intrf");
}
// please note that
public interface Foolish {
void handle();
}
//main
public static void main(String[] args) {
new Foobar().get();
哪条线投掷? – JaredPar 2012-02-16 16:43:52
???没有意义...请发布完整的堆栈跟踪。 – m0skit0 2012-02-16 16:44:48
请显示完整的堆栈跟踪 – amit 2012-02-16 16:45:00