Ty Roner wrote:The NPE is present on lines 124, 230, 264, and 280.
Ty Roner wrote:Alright, I don't think I need the nulls put into the stack. I believe that the code that's causing this is setting operator Object and result Object to null. What should I do to these instead of setting them to null?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ty Roner wrote:Alright, I don't think I need the nulls put into the stack. I believe that the code that's causing this is setting operator Object and result Object to null. What should I do to these instead of setting them to null?
Paul Clapham wrote:
Ty Roner wrote:The NPE is present on lines 124, 230, 264, and 280.
But those aren't the line numbers which are in your post, are they? Because a couple of those lines couldn't possibly throw an NPE.
And anyway the way to avoid the NPE is going to depend on your design. It's likely to be different in different places. So how about if you pick one of the problem lines and tell us what the line number of that line is in the post?
Ty Roner wrote:
It's telling me that I can't cast a string to a character. I'm not entirely sure what to do now, should I change everything to one type? Here's the code snippet:
I am not sure I agree there. There are some instances where a reference can legitimately point to null, but I don't think this is one of thse circumstances.Singh Kuldeep wrote:You can check NPE before using particular object reference.
for example:
when you are going to use "operand" at line 124
I would suggest you to check this condition . . .
Joel Christophel wrote:
Ty Roner wrote:
It's telling me that I can't cast a string to a character. I'm not entirely sure what to do now, should I change everything to one type? Here's the code snippet:
I'm assuming that you have a one character String on your stack instead of a character. So, instead of,
you can try:
It would be better, however, if you had put a Character on the stack in the first place.
Don't get me started about those stupid light bulbs. |