
2.2 Data Types,Variables,and Constants 47
TABLE 2.2 Integer Data Types
Integer Size Minimum Value Maximum Value
Data Type in Bytes
byte 1 128 127
short 2 32,768 32,767
int 4 2,147,483,648 2,147,483,647
long 8 9,223,372,036,854,775,808 9,223,372,036,854,775,807
following these conventions will become clearer as you gain more experi-
ence in Java and your programs become more complex.
2.2.2 Integer Data Types
An integer data type is one that evaluates to a positive or negative whole
number. Java provides four integer data types, int, short, long, and byte.
The int, short, long, and byte types differ in the number of bytes of memory
allocated to store each ...