Tutorialspoint

1 Answer
Samual Sam
, 0 Views

The valueOf() method is used in Java to convert short to string.

Let’s say we have the following short value.

short val = 20;

Converting the above short value to string.

String.valueOf(val);

Example

Live Demo

public class Demo {
   public static void main(String[] args)  {
      short shortVal = 55;
      // converting short to String
      String str = String.valueOf(shortVal);
      System.out.println("String: "+str);
   }
}

Output

String: 55

Advertisements