Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Convert Short into String in Java
Using toString() method to convert Short to string. Firstly, let us take a short primitive datatype and initialize a short value.
short myShort = 55;
Now let us include this value to the following Short object.
Short s = new Short(myShort);
Convert the above given Short to string using the toString() method as shown in the complete example below.
Example
public class Demo {
public static void main(String []args) {
short myShort = 55;
Short s = new Short(myShort);
System.out.println("Short: "+s);
String myStr = s.toString();
System.out.println("String: "+myStr);
}
}
Output
Short: 55 String: 55
Advertisements
