next up previous
Next: Other primitive data types Up: Unit 04 Previous: Definition of constants and

Other primitive data types for integer numbers: byte

Type byte
Dimension 8 bit (1 byte)
Domain the set of integer numbers in the interval [- 27, + 27 - 1] = [- 128, + 127]
Operations + sum
  - difference
  * product
  / integer division
  % rest of the integer division
Literals sequences of digits denoting values of the domain (e.g., 47)

Example:

byte a, b, c;              // Declaration of variables of type byte
a = 1;                     // Use of literals
b = Byte.parseByte("47");  // Conversion from String to byte
c = a - b;                 // Arithmetic expression


next up previous
Next: Other primitive data types Up: Unit 04 Previous: Definition of constants and