Syntax error Java Program to convert Double into String using toString() method of Double class

Java Program to convert Double into String using toString() method of Double class



Let us first declare a Double −

Double ob = new Double(99.12);

Use the toString() method to convert Double into String.

String res = ob.toString();

The following is the complete example.

Example

 Live Demo

public class Demo {
   public static void main(String args[]) {
      Double ob = new Double(99.12);
      String res = ob.toString();
      System.out.println(res);
    }
}

Output

99.12
Updated on: 2020-06-26T09:00:12+05:30

140 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements