Helpful Information
 
 
Category: Java and JSP
Java: NumberFormatException

hi, this is a mystery to me...
I've tried simplifying my code to see where the problems arise..but I can't make it any simpler..and the NumberFormat still won't accept
0, or 0.0 as numbers..
here's the code:
try
{
Double.parseDouble(jTxtFAmount.getText());
}
catch(NumberFormatException ex)
{
jTxtArea.append("The amount entered is illegal\n"+ex.getMessage()+"\n");
}

I'd just as well say, you can't have a zero balance..becuase that's what the exception keeps catching...:mad:

What can I do..any ideas?
:confused:

Just a guess, but I think when you use parseDouble and parseInt, if the result returned is 0, it is equivilant to null. See if you can add something for the null exception.

hi, thanks for the reply.
I forgot about this post..and just today remembered about it, and checked up on it.

As it turns out, it wasn't my code that was wrong, but the class that I'm using won't accpet zero, it throws the numberformatexception.

So thanks anyway.
But it's remedied now.

I will probably drop on by more often, as I'm learning java now.

thank you










privacy (GDPR)