Which of the following statements will convert a string s into a double value d?

Which of the following statements will convert a string s into a double value d?


A. d = Double.parseDouble(s);
B. d = (new Double(s)).doubleValue();
C. d = Double.valueOf(s).doubleValue();
D. All of the above.

The correct answer is D

Explanation: All are fine. a is preferred because it does not have to create an object.


Java

Learn More Multiple Choice Question :