Convert double to string in Java



The valueOf() method is used in Java to convert double to string.

Let’s say we have the following double value −

double val = 10.18465D;

Converting the above double value to string.

String.valueOf(val);

Example

 Live Demo

public class Demo {
   public static void main(String[] args) {
      double val = 98.18465D;
      // converting double to String
      String str = String.valueOf(val);
      System.out.println("String: "+str);
   }
}

Output

String: 98.18465
karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know


Advertisements