Convert short to String in Java


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

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 26-Jun-2020

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements