🔒 Locked
[java] Why do I get this Java console error message...
Advertisement
Original Post
I sometimes get this error message when running my applet:
java.lang.NullPointerException
at CityBoy.update
at com/ms/awt/WComponentPeer.doUpdate
at com/ms/awt/WComponentPeer.doUpdate
at com/ms/awt/WUpdate.run
at com/ms/ui/windowmanager/RunnableMessage.run
at com/ms/awt/WSystemQueue.getMessage
at com/ms/awt/WEventQueue.getNextEvent
at java/awt/EventDispatchThread.run
I don''t get it every time but quite often.
Thanks for any help.
nowan
It will emerge when using a pointer to null, duhh 
something like this:
It doesn't mean that it HAVE to like that, it's one possible error.
Anyway, the thing is that you are using a ptr that you thought pointed to an object, but somehow the object doesn't exist, it has been discarded.
PS. why is it called pointer!?? shouldn't it be called NullReferenceException? Hmmm, don't know.
regards
/Mankind gave birth to God.
Edited by - silvren on October 9, 2001 5:13:55 AM
something like this:
Weapon ref = new Weapon(); |
It doesn't mean that it HAVE to like that, it's one possible error.
Anyway, the thing is that you are using a ptr that you thought pointed to an object, but somehow the object doesn't exist, it has been discarded.
PS. why is it called pointer!?? shouldn't it be called NullReferenceException? Hmmm, don't know.
regards
/Mankind gave birth to God.
Edited by - silvren on October 9, 2001 5:13:55 AM
NullPointer exception means that your "reference" is pointing to absolutely nothing. You might not have initialized the reference. For Example:
//a valid reference that will throw a NullPointerException:
Object myRef;
myRef.toString();//this line will throw a NullPointerException
//a valid reference that will not throw a NullPointerException:
Object myRef;
myRef = new Object();//it is now pointing to an object in memory
myRef.toString();//this line will NOT throw a NullPointerException
//a valid reference that will throw a NullPointerException:
Object myRef;
myRef.toString();//this line will throw a NullPointerException
//a valid reference that will not throw a NullPointerException:
Object myRef;
myRef = new Object();//it is now pointing to an object in memory
myRef.toString();//this line will NOT throw a NullPointerException
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement