Java Data Type How to - Use toString method of Byte class to convert Byte into String








Question

We would like to know how to use toString method of Byte class to convert Byte into String.

Answer

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

The code above generates the following result.