java.lang.Short doubleValue()

Description

The doubleValue() method of Short class retruns the value of this Short as a double after a widening primitive conversion.

Important Notes:

  • This method is specified by doubleValue in class Number.

Method Syntax

public double doubleValue()

Method Argument

Data Type Parameter Description
N/A N/A N/A

Method Returns

The doubleValue() method of Short class returns the numeric value represented by this object after conversion to type double.

Compatibility

Requires Java 1.1 and up

Java Short doubleValue() Example

Below is a simple java example on the usage of doubleValue() method of Short class.

package com.javatutorialhq.java.examples;

/*
 * This example source code demonstrates the use of  
 * doubleValue() method of Short class
 */

public class ShortDoubleValueExample {

	public static void main(String[] args) {

		// Declare a new Short variable
		Short value = 142;

		// get the doubleValue() method result
		double result = value.doubleValue();

		// print the result
		System.out.println("Result:" + result);
		
		/*
		 * Be careful on using this method
		 * Desired result might differ
		 * because of the widening concept
		 * of java language
		 */

	}

}

Sample Output

Below is the sample output when you run the above example.

Java Short doubleValue() method example output