当前位置: 代码迷 >> Java相关 >> 这样子是什么错误
  详细解决方案

这样子是什么错误

热度:97   发布时间:2007-12-22 08:43:10.0
这样子是什么错误
编译的时候可以通过,可运行的时候出现如下这个画面
搜索更多相关的解决方案: 画面  编译  运行  

----------------解决方案--------------------------------------------------------
Exception in thread"main"java.lang.NullPointerException
at Notepad2.initEventListener<Notepad2.java:199>
at Notepad2.<init><Notepad2.java:15>
at Notepad2.main<Notepad2.java:224>
Press any key to continue...
----------------解决方案--------------------------------------------------------
空指针错误
Thrown when an application attempts to use null in a case where an object is required. These include:

Calling the instance method of a null object.
Accessing or modifying the field of a null object.
Taking the length of null as if it were an array.
Accessing or modifying the slots of null as if it were an array.
Throwing null as if it were a Throwable value.
----------------解决方案--------------------------------------------------------
那要怎么避免或改呢?
----------------解决方案--------------------------------------------------------
能用ECLIP调试出最好,也可以检查一下哪里出错,是不是有的变量可能取NULL值,后面引用又用到这个变量,而你没有处理

避免就是要细心喽,呵呵

愚见,见笑.
----------------解决方案--------------------------------------------------------
  相关解决方案