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.


//from   w  w  w. j a v a  2s . c o  m
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.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable