Java Data Type Tutorial - Java Double.parseDouble(String s)








Syntax

Double.parseDouble(String s) has the following syntax.

public static double parseDouble(String s)    throws NumberFormatException

Example

In the following code shows how to use Double.parseDouble(String s) method.


public class Main {
   public static void main(String[] args) {
     String str = "50.00001";
     double retval =Double.parseDouble(str);
     System.out.println("Value = " + retval);
   }
}

The code above generates the following result.