Anders Kviback wrote:I can't figure out why I keep on getting the message Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException.
I have a server client program where the server sends out a mathnumber to the client. The number is shown up on a gui textfield. I put in my answer and hit the sendbutton.
Here is part of the so called MathClientHandler class.
So, when I execute this I get the error message:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Lektion5.MathClientGUINy.actionPerformed(MathClientGUINy.java:147) <--- So, this is the problem
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
Why do I get a NPE here?
There is something wrong with the line
mcn.sendAnswer(tal);
Why doesn't the code understand it, or mcn?
Could anyone please help me here?
Anders
"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
Anders Kviback wrote:So, the problem now is that I get a NPE at line 55 in the MathClientHandler class
and I can't understand why.
And if I hide the statement, ie //operand = talSvar.getOperand();
...
, i e operand = null, but how can it be null?
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|