Skip to Content

Convert Byte object to String object

  1. /*
  2.   Convert Byte object to String object
  3.   This example shows how a Byte object can be converted into String object.
  4. */
  5.  
  6. public class ByteToStringExample {
  7.  
  8.   public static void main(String[] args) {
  9.     Byte bObj = new Byte("10");
  10.    
  11.     //use toString method of Byte class to convert Byte into String.
  12.     String str = bObj.toString();
  13.     System.out.println("Byte converted to String as " + str);
  14.   }
  15. }
  16.  
  17. /*
  18. Output of the program would be
  19. Byte converted to String as 10
  20. */