Convert a String to a double type number in Java


To convert a String to a double type number in Java, use the Double.parseDouble() method.

Here is our string.

String str = "699.7e130";

Let us now convert the above string to double.

double val = Double.parseDouble(str);

Example

 Live Demo

public class Demo {
    public static void main(String args[]) {
       String str = "699.7e130";
       double val = Double.parseDouble(str);
       System.out.println(val);
    }
}

Output

6.997E132

Updated on: 26-Jun-2020

191 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements