VOOZH about

URL: https://www.geeksforgeeks.org/java/java-integer-bytevalue-method/

⇱ Java Integer byteValue() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Java Integer byteValue() Method

Last Updated : 6 May, 2022

The byteValue() method of Integer class of java.lang package converts the given Integer into a byte after a narrowing primitive conversion and returns it (value of integer object as a byte). Also, remember this method does override byteValue() method of the Number class.  

The package view is as follows:

--> java.lang Package 
 --> Integer Class
 --> byteValue() Method 

Syntax :

public byte byteValue()

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

Note: It is compatible with Java 1.5 and onwards.

Example 1:

Output:
34

Example 2:

Output:
Byte object : 1
Primitive byte value of Byte object : 1
Comment