Short byteValue() in Java

byteValue(): This method is available in java.lang.Short class of Java.

Syntax:

byte java.lang.Short.byteValue()

This method returns the value of this Short as a byte after a narrowing primitive conversion.

Parameters: NA

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

Exceptions: NA

Approach

Java

public class ShortbyteValue {
    public static void main(String[] args) {

        Short short1 = 1;

        System.out.println(short1.byteValue());
    }
}

Output:

1

No comments:

Post a Comment