freelanceprogrammers.org Forum Index » Java
Converting String to double
Joined: 16 Feb 2002
Posts: 18
Converting String to double
Can anyone out there, pls help. I need to convert
String to a double value...<br><br>public class
test<br>{<br>public static void main (String [] args)<br>{<br>String
stringValue = new String("147.82");<br>Double tempValue =
Double.valueOf(stringValue);<br>double doubleValue =
doubleValue(tempValue);<br>}<br>}<br><br>But I got error during compilation. The
following is
the error. Pls help<br>d:Program FilesXinox
SoftwareJCreator LEMyProjects est.java:7: cannot resolve
symbol<br>symbol : method doubleValue
(java.lang.Double)<br>location: class test<br>double doubleValue =
doubleValue(tempValue);<br><br>Anyone had any idea why this is so, cos i follow
it
exactly from the book.<br><br>many thank in
adwance.<br><br>Regards,<br>Arick
Joined: 14 Feb 2002
Posts: 50
Converting String to double
Change the line:<br><br>double doubleValue =
doubleValue(tempValue);<br><br>To:<br><br>double doubleValue =
tempValue.doubleValue();<br><br>The
doubleValue() method is an instance method which you use on
your tempValue which is an instance of the Double
class.<br><br>Sincerely,<br>Anthony Eden
Joined: 16 Feb 2002
Posts: 18
Converting String to double
Thank You very much... I had been scratch my skull for more than a week
now...<br><br>I am truly grateful<br><br>Sincerely,<br>Arick
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







