Home » Java Short byteValue() method with Examples

Java Short byteValue() method with Examples

by Online Tutorials Library

Java Short byteValue() Method

The byteValue() method of Java Short class is a wrapper class.

Syntax

Parameters

N/A

Return value

Returns the value of this Short class as a byte after a narrowing primitive conversion. If we override byteValue in Number class then it will return Numeric Value represented by this object after conversion to byte type.

Example 1

Test it Now

Output:

Byte b = 45 

Example 2

Test it Now

Output:

byte b value = -125  

Example 3

Test it Now

Output:

byte Value of b = 68  

Example 4

Test it Now

Output:

byte Value of b = -119 

Example 5

Test it Now

Output:

55 

Next TopicJava Short

You may also like