Solved

converting string to double

Posted on 2001-09-17
1
195 Views
Last Modified: 2010-03-31
hi,

I know that you can convert a string to an integer by

int q_no;
String q_string = "4";

q_no = Integer.parseInt(q_string);

but I want to convert a string to a double. Any suggestions?

Thanks
Clo
             
0
Comment
Question by:clodaghm
1 Comment
 
LVL 1

Accepted Solution

by:
kanthonym earned 50 total points
ID: 6488063
static Double valueOf(String s)
          Returns a new Double object initialized to the value represented by the specified string.


Double myNum = Double.valueOf( "stringvalue of number" )
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tomcat: Unable to run tomcat service. 2 28
hashmap order 17 40
maven not picking latest jar instead picking old jar from .m2 12 42
junit example issue 2 22
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question