Java.lang.Double.doubleValue() Method

Advertisements


Description

The java.lang.Double.doubleValue() method returns the double value of this Double object.

Declaration

Following is the declaration for java.lang.Double.doubleValue() method

public double doubleValue()

Parameters

  • NA

Return Value

This method returns the double value represented by this object.

Exception

  • NA

Example

The following example shows the usage of java.lang.Double.doubleValue() method.

package com.tutorialspoint;

import java.lang.*;

public class DoubleDemo {

   public static void main(String[] args) {

     // returns the double value of this Double object
     Double obj = new Double("10.35");
     double d = obj.doubleValue();
     System.out.println("Value = " + d);
    
     obj = new Double("90");
     d = obj.doubleValue();
     System.out.println("Value = " + d);
   }
} 

Let us compile and run the above program, this will produce the following result:

Value = 10.35
Value = 90.0



Advertisements
Advertisements