The short primitive

suggest change

A short is a 16-bit signed integer. It has a minimum value of -215 (-32,768), and a maximum value of 215 ‑1 (32,767)

short example = -48;
short myShort = 987;
short anotherShort = 17;

short addedShorts = (short) (myShort + anotherShort); // 1,004
short subtractedShorts = (short) (myShort - anotherShort); // 970

The maximum and minimum values of short can be found at:

short high = Short.MAX_VALUE;        // high == 32767
short low = Short.MIN_VALUE;         // low == -32768

The default value of a short is 0

short defaultShort;    // defaultShort == 0

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Primitive Data Types:
* The short primitive

Table Of Contents
8 Arrays
10 Maps
11 Strings
25 JAXB
26 Primitive Data Types
29 Enums
32 Audio
41 Scanner
63 Logging
75 Lists
78 Sets
89 JAX-WS
96 XJC
98 Process
106 Modules
114 Applets
122 JNDI
139 JavaBean
141 Literals
144 Packages
150 JMX
153 JShell
159 Sockets
167 Enum Map
175 Hashtable
177 SortedMap