Java Data Type Tutorial - Byte byteValue() example








Byte byteValue() returns the value of this Byte as a byte type.

Syntax

byteValue has the following syntax.

public byte byteValue()

Overrides

byteValue in class Number

Example

In the following code shows how to use Byte.byteValue() method.

public class Main {
  public static void main(String[] args) {
    Byte byteObject = new Byte("10");
    byte b = byteObject.byteValue();
    System.out.println("byte:"+b);

  }
}

The output: