Convert double value to string in Java



To convert double value to string, use the toString() method in Java. The method represents a value in string.

Let’s say the following is our double to be converted.

double doubleVal = 333.24;

Now, convert it to string.

String str = Double.toString(doubleVal);

The following is the final example.

Example

 Live Demo

public class Demo {
   public static void main(String args[]) {
      double doubleVal = 333.24;
      String str = Double.toString(doubleVal);
      System.out.println(str);
   }
}

Output

333.24
Samual Sam
Samual Sam

Learning faster. Every day.


Advertisements