YouTip LogoYouTip

Number Xxxvalue

# Java xxxValue() Method [![Image 3: Java Number Class](#)Java Number Class](#) * * * The xxxValue() method is used to convert a Number object to the **xxx** data type value and return it. Related methods are: | Type | Method and Description | | --- | --- | | byte | **byteValue() :** Returns the value of the specified number as a byte. | | abstract double | **doubleValue() :** Returns the value of the specified number as a double. | | abstract float | **floatValue() :** Returns the value of the specified number as a float. | | abstract int | **intValue() :** Returns the value of the specified number as an int. | | abstract long | **longValue() :** Returns the value of the specified number as a long. | | short | **shortValue() :** Returns the value of the specified number as a short. | ### Parameters None of the above functions accept any parameters. ### Return Value The numeric value represented by this object after conversion to the **xxx** type. ### Example ## Test.java File public class Test{public static void main(String args[]){Integer x = 5; // Returns byte primitive data type System.out.println(x.byteValue()); // Returns double primitive data type System.out.println(x.doubleValue()); // Returns long primitive data type System.out.println(x.longValue()); }} Compile the above program, the output result is: 55.05 * * Java Number Class](#)
← Number EqualsWindows Docker Install β†’