java.lang.Byte intValue()

Description

The intValue() method of Byte class returns the value of this Byte as an int after a widening primitive conversion.

Important Notes:

  • The method  intValue() is specified by intValue in class Number.

Method Syntax

public int intValue()

Method Argument

Data Type Parameter Description
N/A N/A N/A

Method Returns

The intValue() method of Byte class returns the numeric value represented by this object after conversion to type int.

Compatibility

Requires Java 1.1 and up

Java Byte intValue() Example

Below is a simple java example on the usage of intValue() method of Byte class.

Basically on the above example, we have asked the user to enter a number on the console. Internally the input value is assign to a Byte object. We then use the intValue() method to convert it into type int. It doesn’t do much however it shows the basic behaviour of this method.

Sample Output

Below is the sample output when you run the above example.

java Byte intValue() example output