Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-06-2002, 02:50 AM   PM User | #1
IBM
New Coder

 
Join Date: Jul 2002
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
IBM is an unknown quantity at this point
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...

What can I do..any ideas?
__________________
We all have souls, where do you want yours to go?

The little princess
Back from the dead
A Love Story
The only Hope / End Times
IBM is offline   Reply With Quote
Old 11-06-2002, 11:26 AM   PM User | #2
bcarl314
Mega-ultimate member


 
Join Date: Jun 2002
Location: Winona, MN - The land of 10,000 lakes
Posts: 1,855
Thanks: 1
Thanked 45 Times in 42 Posts
bcarl314 will become famous soon enough
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.
bcarl314 is offline   Reply With Quote
Old 11-07-2002, 07:13 AM   PM User | #3
IBM
New Coder

 
Join Date: Jul 2002
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
IBM is an unknown quantity at this point
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
__________________
We all have souls, where do you want yours to go?

The little princess
Back from the dead
A Love Story
The only Hope / End Times
IBM is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:36 AM.


Advertisement
Log in to turn off these ads.