Skip to Content

Convert Short object to String object

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