打印

数据转换的怪事 java

数据转换的怪事 java

我想把从text.getText()里获得的字符串S,转换成double
用语句:double d=Double.parseDouble(S);
为什么调试时,总是报错:'parseDouble' is not a method in class 'Double'
请高手指教一下!

TOP

parseDouble is not available in JDK 1.1.8. If you are running your code in an Applet under, say, Internet Explorer, the Java VM from Microsoft only supports 1.1.8. This is the only reason I can think of.

To work this around, try:
double d=Double.valueOf(S).doubleValue();

TOP

成了,thank u!!!!!!!!!!!!!!!!!!!!!

TOP