September 30, 2019

Beginner’s Guide to the Short Primitive

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 = -32; short myShort = 1234; short anotherShort = 16; short addedShorts = (short) (myShort + anotherShort); // 1250short subtractedShorts = (short) (myShort – anotherShort);