English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Let's first create a short primitive type and assign a value to it.
short val = 30;
Now, create a Short object and set it to the above short type.
Short myShort = new Short(val);
This is a complete example of converting a short primitive type to a Short object using the Short constructor.
public class Demo { public static void main(String[] args) { short val = 30; Short myShort = new Short(val); System.out.println(myShort); } }
Output Result
30