short
This type is a 16-bit, signed, two's-complement integer. The main reasons for using short are to match external values already present in a file or to economize on storage space where you have a large number of such values.
range of values: –32,768 to 32,767
literals: There are no short literals. You can use, without a cast, int literals provided their values will fit in 16 bits. You can use char, long, and floating-point literals if you cast them.
As with byte, assignments to short must always be cast into the result if the right-hand side of the assignment involves any arithmetic.
The last two primitive types, double and float, are floating-point arithmetic types. Before we look at the features of double and float, Limited Accuracy ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access