Java.lang Package Classes

Java Byte - doubleValue() Method

The java.lang.Byte.doubleValue() method returns the value of this Byte as a double after a widening primitive conversion.


public double doubleValue()


No parameter is required.

Return Value

Returns the numeric value represented by this object after conversion to type double.




In the example below, the java.lang.Byte.doubleValue() method returns a Byte object after conversion to type double.

import java.lang.*;

public class MyClass {
  public static void main(String[] args) {
    //creating Byte objects
    Byte val1 = 25;
    Byte val2 = -25;

    //printing doubleValue of the Byte objects
    System.out.println("doubleValue of the val1 is: " + val1.doubleValue()); 
    System.out.println("doubleValue of the val2 is: " + val2.doubleValue());   

The output of the above code will be:

doubleValue of the val1 is: 25.0
doubleValue of the val2 is: -25.0

❮ Java.lang - Byte