PDA

View Full Version : Java Question


Unregistered
09-18-2005, 06:41 PM
Hello to anyone who's reading this! I'm new to java, but so far everything's been okay... except this. My program is telling me that "parseDouble" does not exist. I'm not going to show the whole program because it's 100 lines long, so just look at this:

String input2;
double r;

input2 = txtThird.getText ();
r = Double.parseDouble (input2);

Yes, txtThird does exist it's just too far up in the program. If i use "r = Integer.parseInt (input2);" it works, but what i'm writing requires double. I've checked some sites and parseDouble should exist. What's going on?

Unregistered
09-18-2005, 07:01 PM
Just say that if i can't get an answer this evening...i'll probably see someone tomorrow who'll know what to do

fischerm
09-18-2005, 08:27 PM
Yep you're right, it should work. I whipped this up real quick:import java.util.*;

public class HelloDouble {

public static void main (String args[]) {
double r;
Double d;

r = Double.parseDouble("5");

r = r + 10.09288372;

d = new Double(r);

System.out.println( "Hello Double");
System.out.println( d.toString() );
}
}And it outputs:Hello Double
15.09288372
Sooooo I dunno what's going on without seeing more of it. Double has been in since SDK 1, so I really doubt it has anything to do with your version.

dparm
09-19-2005, 12:09 PM
Perhaps you could just avoid the use of a double completely?

Unregistered
09-22-2005, 05:49 PM
Hey guys, thanks! I ended up asking a friend of mine. Guess what? The code works absolutely, but not on my version of Java Ready. *mutters* Stupid outdated version. TTYL!