English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Convert Short to String using Java

UsingtoString()The method converts Short to string. First, let's take a primitive data type of short and initialize a short value.

short myShort = 55;

Now, let's include this value in the following Short object.

Short s = new Short(myShort);

UsingtoString()The method shown in the complete example below converts the given Short to a string.

Example

public class Demo {
   public static void main(String []args) {
      short myShort = 55;
      Short s = new Short(myShort);
      System.out.println("Short: "+s);
      String myStr = s.toString();
      System.out.println("String: "+myStr);
   }
}

Output Result

Short: 55
String: 55