readthefuckingmanual.net

[SOLVED] java.lang.NullPointerException

Error added: 2005-10-30T02:30:44Z

0 people waiting for the answer...

1 answers found.

Answer 47 (0.0% helpful)

You're kidding, right?

This can be found in many applications, but more likely one you\'re writing yourself (shame on you!)

Here's a description of it from the first search result:
--------------
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. 
-----------

A summary of the above:
You are probably trying to use something that hasn\'t been initialized.

The solution:
Make sure the object, method, parameter, whatever is initialized before you use it!
Permalink

Add an answer/solution

If you know the answer, please add your own solution below.
If you don't know, but find out later, please come back and share your answer - there will be other people struggling with this too.


Please enter 61948 here

If you want to be notified via email when this is solved, enter your email address here: