Convert double to String in Java

With the help of String.valueOf() and Double.toString() methods, you can convert double to String in Java.

Example of Java double to String conversion

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

public class Example
	public static void main(String args[])
		double d = 20.4;
		String a = String.valueOf(d);		
		String b = Double.toString(d);
		System.out.println("a = "+a);
		System.out.println("b = "+b);


a = 20.4
b = 20.4