Java Data Type Tutorial - Byte toString() example








Byte toString() converts Byte to a String object.

Syntax

toString has the following syntax.

public String toString()

Overrides

toString in class Object

Example

The following two examples is showing how to convert byte value to string value.

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

The outputs: