What does this mean ?java.lang.NullPointerException

What does this mean ?
Uncaught exception in evaluation: java.lang.NullPointerException.

How would you fix this ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tricky! You'll have to look through the 'evaluation' method for objects that should have been initialised but weren't
what are you doing?
heyas.. not too sure if your new to java soooo..

could you post come code?

also, to expand on CEHJ's suggestion: "look through the 'evaluation' method for objects that should have been initialised but weren't "

in newbie's terms this means the following:

Object whatever; => Uninitialised object
Object whatever = new Object(); => the 'new' operator calls the constructor of that class and thus initialises the object..

Now in regard to your 'evaluation' method.. it may look like:

public void evaluation( object Object) {..} .. the parameter, Object, that you pass this method MUST be initilalised.. a common error is to have the following..

if {}
else {

but since you have not initialised the object initially, there is a CHANCE that you might pass an object assigned as null. A quick fix is possibly to modify your initial instance variable from:
Object object;
to Object object = new Object();

the success of this will be dependent on your code.

hope this helps somewhat :)

CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

NullPointerException is thrown by the JVM when you are invoking a method on a null object.  Make sure your object references refer to actual objects before you invoke methods on them.
Please don't repeat comments that have already been made
Mick BarryJava DeveloperCommented:
> Please don't repeat comments that have already been made

I was about to make the same comment as I didn't see where anyone had explained that.
There are many ways an NPE can occur than  just an unitialised var, and is not a clear explanation of an NPE.
>>Uncaught exception in evaluation

Does this not mean that no exception occured still but we need to use a try catch to catch the Exception ...
Correct me if I am wrong

eg for pheats
if you have

public int Test() throws NullPointerException
 if ( a< 5 )
     throw new NullPointerExeption
return a;

and we use

int b = Test()

this needs to be used as
int b = Test()
catch (NullPointerException e)

Hope this helps.
No, NullPointerException does not have to be caught
Mick BarryJava DeveloperCommented:
> Does this not mean that no exception occured still but we need to use a try catch to catch the Exception ...

No it means an exception was thrown but it wasn't caught.
One way of reproducing this would be to call evaluation here:

public static void evaluation() {
      try {
      catch(Exception e) {
            System.err.println("Uncaught exception in evaluation: " + e.getClass().getName());

public static void x() {
      String s = null;
      int i = s.length();

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Maybe the simplest example would be:

String testString = null;
testString.substring(2); // Will throw a NullPointerException

Since testString does not refer to any real object, a NullPointerException is thrown.
pheatsAuthor Commented:
I tried this and it proved that what is was doing was wrong.

I was able to catch the evaluation error.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.