Results 1 to 5 of 5
Thread: NullPointerExecptions
- 09-24-2011, 03:43 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 38
- Rep Power
- 0
NullPointerExecptions
I keep getting a null pointer exception in a pacman program I'm designing. There is only one object reference in the line that has the error. I know i instantiated that object, too. In addition, the line works, as in it returns the correct number despite having a null pointer exception. The code isn't too long, so I don't know if i should post it or not.
-
Re: NullPointerExecptions
- 09-24-2011, 03:48 PM #3
Re: NullPointerExecptions
We need to see the FULL text of the error message and the lines of code that are referenced in the error message.
You could look at the error message and see where in your program the error occurred and then look at that statement to determine which variable is null. Then backtrack in your code to see why the variable does not have a valid value.
- 09-24-2011, 04:53 PM #4
Member
- Join Date
- Jul 2011
- Posts
- 38
- Rep Power
- 0
Re: NullPointerExecptions
I already checked the line and it contains one object reference and i know it isn't null.
-
Re: NullPointerExecptions
The JVM isn't lying, and something on the line that is throwing the exception is null, regardless of what you or I say. And again, have you checked for variable shadowing? This is something that can make it look like we've initialized a variable when in fact we have not.
But more importantly you've got two folks asking for the code, the full error message, and an indication of which line throw the NPE. Why continue to debate when we can see for sure? Let's see what you've got. :)Last edited by Fubarable; 09-24-2011 at 05:26 PM.


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks