Need a little help.

What does a java.lang.NullPointerException mena and what would cause it to happen?
[89 byte] By [blackieula] at [2007-9-30 1:46:14]
# 1

> What does a java.lang.NullPointerException mena and

> what would cause it to happen?

A reference variable contains either a reference to an object (which you get by doing new on a class) or null (no reference). If you use the variable to reference an object when it in fact contains null you get a null pointer exception.

UlrikaJa at 2007-7-16 6:24:32 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
Thank You
blackieula at 2007-7-16 6:24:32 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 3
it means you have a nullpointerHappens when you call a method on a null object.Object test=null;test.anyMethod() will result in NullPoinetrException
pgeuensa at 2007-7-16 6:24:32 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 4

A reference (held in a reference variable) is sometimes also called a pointer because it can be thought of as pointing at a specific object somewhere in memory. The nullpointer, called null in Java, points at nothing. If you still use it as if it would be pointing at something you get this exception.

UlrikaJa at 2007-7-16 6:24:32 > top of Java-index,Archived Forums,New To Java Technology Archive...