Javatpoint Logo
Javatpoint Logo

Java Integer byteValue() method

The byteValue() is a method of byte class under java.lang package. It converts the given number into a primitive byte type and returns the value of integer object as byte. Also, it override the byteValue() method of Number class.

Syntax

Following is the declaration of byteValue() method:

Parameter:

DataType Parameter Description
byte NA It returns the value of integer object as byte

Returns:

The byteValue() method returns the numeric value represented by this object after conversion to the primitive byte type.

Exceptions:

NA

Compatibility Version:

Java 1.5 and above

Example 1

Output:

Enter the Desired Numeric Value: 55
The Value of Byte is: 55

Example 2

Test it Now

Output:

34

Example 3

Test it Now

Output:

The Byte object is: 80
Primitive byte value of Byte object is: 80

Example 4

Test it Now

Output:

b = -1
i2 = 255

Next TopicCompare() Method





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA