The short primitive
suggest changeA short is a 16-bit signed integer. It has a minimum value of -2^15 (-32,768) and a maximum value of 2^15 - 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 field is 0.
short defaultShort; // defaultShort == 0
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents