Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error Msg  RSS feed

 
Mohksin Rashid
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all... may i noe what NullPointerException error means? and it says "fail to load reference image"? anyone can help?

thx in advance.


Mohksin Rashid
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NullPointerException usually refers to a calling of a method using a reference variable that is pointing to null, rather than an instance of an object.

For Instance



The numbers are there just for explaining the lines.

So on Line #2 there is no MyClass instance, so a call to runSomeMethod on using the reference variable "var" would result in a NullPointerException, because "var" is null.

Now in Line #5, that would run because now "var" points to an actual instance of MyClass created on line #4.

Hope that helps

Mark
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!