next up previous
Next: Other primitive data types Up: Unit 04 Previous: Other primitive data types

Other primitive data types for integer numbers: short

Type short
Dimension 16 bit (2 byte)
Domain the set of integer numbers in the interval [- 215, + 215 - 1] = [- 32768, + 32767]
Operations + sum
  - difference
  * product
  / integer division
  % rest of the integer division
Literals sequences of digits denoting values of the domain (e.g., 22700)

Example:

short a, b, c;                  // Declaration of variables of type short
a = 11300;                      // Use of literals
b = Short.parseShort("22605");  // Conversion from String to short
c = b % a;                      // Arithmetic expression


next up previous
Next: Other primitive data types Up: Unit 04 Previous: Other primitive data types