I want to convert String to a Double data type. I do not know if I should use parseDouble or valueOf.
What is the difference between these two methods?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
parseDoublereturns a primitive double containing the value of the string:valueOfreturns a Double instance, if already cached, you’ll get the same cached instance.To avoid the overhead of creating a new Double object instance, you should normally use
valueOf