Java Short - toString() Method
The java.lang.Short.toString() method returns a new String object representing the specified short. The radix is assumed to be 10.
Syntax
public static String toString(short s)
Parameters
s |
Specify the short to be converted. |
Return Value
Returns the string representation of the specified short.
Exception
NA.
Example:
In the example below, the java.lang.Short.toString() method returns a String object representing the given short.
import java.lang.*; public class MyClass { public static void main(String[] args) { //creating a short value short x = 25; //printing the short value System.out.println("The short value is: " + x); //creating and printing the string //representation of the short value String x_tostring = Short.toString(x); System.out.println("The string value of short is: " + x_tostring); } }
The output of the above code will be:
The short value is: 25 The string value of short is: 25
❮ Java.lang - Short