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 primitive type to Short object in Java
Let us first create a short primitive type and assign a value.
short val = 30;
Now, create a Short object and set the above short type to it.
Short myShort = new Short(val);
The following is the complete example to convert short primitive type to Short object using Short constructor.
Example
public class Demo {
public static void main(String []args) {
short val = 30;
Short myShort = new Short(val);
System.out.println(myShort);
}
}
Output
30
Advertisements
