
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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