Error instantiating an object

1

When I instantiate the object Vendedor this error appears:

java.lang.NullPointerException
    at Vendedor.<init>(Vendedor.java:9)

I would like to know what it means and how I solve it.

    
asked by anonymous 06.06.2014 / 23:17

2 answers

1

It means that NullPointerException occurred on line 9 of the file Vendor.java

Solution:

Do not cause a NullPointerException : -)

Tip: anyVariable. AnyCase () causes NullPointerException if anyVariable is null.

    
06.06.2014 / 23:24
2

The exception NullPointerException is thrown when the program tries use the reference of an object with the null value. Here's an example:

public static void main (String[] args) throws java.lang.Exception
{
    String foo = null;
    System.out.println(foo.toString()); // NullPointerException será lançada
}
    
07.06.2014 / 00:19