| Author |
parseDouble Problem
|
henri henri
Ranch Hand
Joined: Oct 03, 2005
Posts: 115
|
|
Hello, Below is the printout in Netbeans of my JavaBean ouput. The last value was typed in the TextField was 5.1 for the audio value. I have tested it may times and it always come out as 0.0 Further down is the code to parse my String to a double from the TextField. If I need a double, ddoes the user need to type it in with a decimal point in between two numbers. Would anyone guess why it comes out as 0.0? Here is a link to a screenshot to give you an ideaof what it is I am working on. Thanks. http://pollscanada.com/screenshot.html init: deps-jar: compile-single: run-single: Cabin Fever, Horreur, 2002, 92 Minutes, Audio 0.0 BUILD SUCCESSFUL (total time: 0 seconds)
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24059
|
|
This line double audio2 = Double.parseDouble(audio1); declares a local variable and initializes it. Since the block it's in ends immediately after, nobody ever uses this variable. Perhaps there's also a member variable named audio2 that you're trying to assign to? In that case, you need to remove the "double", which turns this from a declaration of a new variable into a simple assignment to an existing variable.
|
[Jess in Action][AskingGoodQuestions]
|
 |
henri henri
Ranch Hand
Joined: Oct 03, 2005
Posts: 115
|
|
|
Thank you for your response. It is quite mind-boggling. I will try your suggestion.
|
 |
henri henri
Ranch Hand
Joined: Oct 03, 2005
Posts: 115
|
|
|
It turns out it was an oversight of mine. I had declared my double twice. Once as a member and then inside a try.block
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24059
|
|
|
Yep. Isn't that what I said?
|
 |
 |
|
|
subject: parseDouble Problem
|
|
|