Click here to Skip to main content
15,891,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I got the following error message while trying to make a hangman app . Please help me out here.

Running in the identified_third_party security domain
java.lang.NullPointerException
	at hangman_game.hangman_game.gamevariables(+14)
	at hangman_game.hangman_game.process(+4)
	at hangman_game.hangman_game.commandAction(+12)
	at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
	at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
	at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
	at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
	at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.handleVmEvent(+186)
	at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+57)
Posted

You get a null pointer exception when you are trying to use a variable/object when it has not been assigned/initialized.

From your exception the problem is in the gamevariables method, start by looking there.
 
Share this answer
 
Run in debug mode and place a breakpoint as it enters the gamevariables method.
Check every object has been initialised before being used.

If this is a regularly called method then it might be better to first run it and allow it to crash, thus letting you identify the line where it throws the exception.

Whatever you do, any decent Java IDE will support easy debugging tasks such as this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900