error: Exception in thread "main" java.lang.NullPointerException

0

I'm trying to give a set an attribute that is a vector, and that is in a y class, however I'm having a x class, which is made up of this y class.

At the time I write the code does not give any error, however when I run the following error I get:

  

error: Exception in thread "main" java.lang.NullPointerException at   Request.readMasses (Request.java:80)

How can I resolve this?

Class y:

Classx:

    
asked by anonymous 14.11.2016 / 18:09

1 answer

0

The error:

  

Exception in thread "main" java.lang.NullPointerException at   Request.readMasses (Request.java:80)

means that you are trying to do some operation on an object that is null! I usually say that it is the simplest error to be corrected in java, because it directs us to exactly that object! ;)

For your code, your " massas " object at line 80 of the "Order" class (Class X) is null and you are trying to add a description to it.

Since I could not test your code, I can just give you the hint of initializing your object before setting attributes on it.

A simple Massas massas = new Massas(); before line 80 would solve your problem.

    
14.11.2016 / 19:18