Create a Double object using constructors in Java

Description

The following code shows how to create a Double object using constructors.

Example


//from   ww w  .  j  av a 2s . c om
public class Main {

  public static void main(String[] args) {
    double d = 10.10;
    Double dObj1 = new Double(d);

    System.out.println(dObj1);

    Double dObj3 = new Double("25.34");
    System.out.println(dObj3);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Reflection »




Annotation
Array
Class
Constructor
Field
Generics
Interface
Method
Modifier
Package
Proxy