Java.lang.Short toString() method in Java with Examples Last Updated : 17 Jun, 2019 Comments Improve Suggest changes Like Article Like Report toString(short) The static toString() method of java.lang.Short returns a new String object representing the specified short. The radix is assumed to be 10.This is a static method hence no object of Short class is required for calling this method. Syntax: public static String toString(short b) Parameters: This method accepts a parameter b which is the short value for which string representation is required. Below is the implementation of toString() method in Java: Example 1: Java // Java program to demonstrate working // of java.lang.Short.toString() method import java.lang.*; public class GFG { public static void main(String[] args) { short a = 515; // using toString() System.out.println("String value: " + Short.toString(a)); } } Output: String value: 515 Example 2: Java // Java program to demonstrate working // of java.lang.Short.toString() method import java.lang.*; public class GFG { public static void main(String[] args) { short a = 51; // using toString() System.out.println("String value: " + Short.toString(a)); } } Output: String value: 51 toString() The non-static toString() method of java.lang.Short returns a String object representing this Short object value. The value is converted to signed decimal representation and returned as a string, exactly as if the short value were given as an argument to the toString(short) method. Syntax: public String toString() Parameters: This method do not accepts any parameter. Returns: This method returns a string representation of the value of this Short object in base 10. Below is the implementation of toString() method in Java: Example 1: Java // Java program to demonstrate working // of java.lang.Short.toString() method import java.lang.*; public class GFG { public static void main(String[] args) { short a1 = 515; // create Short object Short a = new Short(a1); // using toString() System.out.println("String value: " + a.toString()); } } Output: String value: 515 Example 2: Java // Java program to demonstrate working // of java.lang.Short.toString() method import java.lang.*; public class GFG { public static void main(String[] args) { short a1 = 51; // create Short object Short a = new Short(a1); // using toString() System.out.println("String value: " + a.toString()); } } Output: String value: 51 Reference: https://docs.oracle.com/javase/9/docs/api/java/lang/Short.html#toString-- https://docs.oracle.com/javase/9/docs/api/java/lang/Short.html#toString-short- Comment More infoAdvertise with us Next Article Java.lang.Short toString() method in Java with Examples S Sruti Rai Follow Improve Article Tags : Misc Java Practice Tags : JavaMisc Similar Reads ShortBuffer toString() method in Java with Examples The toString() method in java.nio.ShortBuffer is used to return a string summarizing the state of this buffer. Syntax: public String toString() Return Value:The method returns a summary string. Below are the examples to illustrate the toString() method: Program 1: Java // Java program to demonstrate 1 min read Level toString() method in Java with Examples The toString() method of java.util.logging.Level is used to get the string value which represents this Level.This method returns a string representation of this Level. Syntax: public String toString() Parameters: This method accepts nothing. Return: This method returns a string representation of thi 1 min read String toString() Method in java with Examples String toString() is the built-in method of java.lang which return itself a string. So here no actual conversion is performed. Since toString() method simply returns the current string without any changes, there is no need to call the string explicitly, it is usually called implicitly. Syntax : publ 1 min read Scanner toString() method in Java with Examples The toString() method of java.util.Scanner class returns the string representation of this Scanner. The exact format is unspecified. Syntax: public String toString() Return Value: This function returns the string representation of this scanner. Below program illustrates the above function: Program 1 1 min read Locale toString() Method in Java with Examples The toString() method of Locale class in Java is used to return a string representation of this locale. Each element i.e., the language, country or the variant of the locale is separated by underbars Syntax: LOCALE.toString() Parameters: This method does not take any parameters. Return Value: This m 1 min read Stack toString() method in Java with Example The toString() method of Java Stack is used to return a string representation of the elements of the Collection. The String representation comprises a set representation of the elements of the Collection in the order they are picked by the iterator closed in square brackets[].This method is used mai 2 min read LongAdder toString() method in Java with Examples LongAdder class in Java creates a new adder with an initial sum of zero. The Java.LongAdder.toString() is an inbuilt method in Java that returns the String representation of this LongAdder. When the object of the class is created its initial value is zero. Syntax: public String toString() Parameters 2 min read Path toString() method in Java with Examples The Java Path interface was added to Java NIO in Java 7. toString() method of java.nio.file.Path used to return the string representation of this path. If this path was created by converting a path string using the getPath method then the path string returned by this method may differ from the origi 2 min read Optional toString() method in Java with examples The toString() method of java.util.Optional class in Java is used to get the string representation of this Optional instance. Syntax: public String toString() Parameters: This method accepts nothing. Return value: This method returns the string representation of this Optional instance. Below program 1 min read Like