Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes need help with string to double conversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need help with string to double conversion" Watch "need help with string to double conversion" New topic

need help with string to double conversion

Brent Geeeee

Joined: Mar 15, 2006
Posts: 2
hey im doing a program i cant get right,

first im trying to get input and convert it to a double value
im using the JOptionPane.showDialog for the input,

second wat symbol do u use for the square root of or the square of something in an equation?
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398
First to convert a String to a double you can use Double.parseDouble.

The class java.lang.Math has methods for taking the square root and square.

There is no symbol for square root or square.
marc weber

Joined: Aug 31, 2004
Posts: 11343

"Brent Geeeee,"

Welcome to JavaRanch!

Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names.

You can edit your name here. Thank you for your prompt attention!


PS: As Keith said, there are no Java operators for squares or roots, so do NOT make the mistake of using the bitwise "exclusive or," as in x^2. Instead, you should use methods in the Math class.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: need help with string to double conversion
It's not a secret anymore!