Java Data Type Tutorial - Byte Byte(byte value) example








Byte Byte(byte value) creates a Byte object from the specified byte value.

Syntax

Byte has the following syntax.

public Byte(byte value)

Example

In the following code shows how to use Byte.Byte(byte value) constructor.

public class Main {
  public static void main(String[] args) {
/*from   w  w  w  .  j a  v a  2s  . c  om*/

    byte b = 101;
    Byte byteObject2 = new Byte(b);
    System.out.println(byteObject2);

  }
}

The output: