Java.lang.Short.toString() Method

Advertisements


Description

The java.lang.Short.toString() method returns a String object representing this Short value. The value is converted to signed decimal representation and returned as a string

Declaration

Following is the declaration for java.lang.Short.toString() method

public String toString()

Parameters

  • NA

Return Value

This method returns a string representation of the value of this object in base 10.

Exception

  • NA

Example

The following example shows the usage of java.lang.Short.toString() method.

package com.tutorialspoint;

import java.lang.*;

public class ShortDemo {

   public static void main(String[] args) {

     // create short object and assign value to it
     short sval = 50;   
     Short shortValue = new Short(sval);
     
     // returns a String object representing this Short value.
     System.out.println("Value is = " + shortValue.toString());
  }
}

Let us compile and run the above program, this will produce the following result:

Value is = 50



Advertisements
Advertisements