Convert String to double in Java

With the help of Double.parseDouble() method, you can convert String to double in Java.

Example of Java String to double conversion

Following is the example that will show conversion from String to double-

public class Example
{
	public static void main(String args[])
	{
		String s = "331.4";
		double d = Double.parseDouble(s);
		System.out.println(d);
	}
}

Output

331.4