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.
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.
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.
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
}