This preview shows page 1. Sign up to view the full content.
Unformatted text preview: h a
semicolon (;). The variable declarations at the beginning are also statements, but they are
not action statements. Variable declarations just reserve memory to store information. 5.1 Integer variables (int, short, long, byte, char) 101 Although the memory space that is reserved for an int variable is rather large, 4
bytes, there are limitations how large values can be stored in an int variable. A 4-byte
int variable can store values in the ranges
-2,147,483,648, ... , -1, 0, 1, ... , 2,147,483,647 (decimal numbering system)
-80000000H, ..., -1, 0, 1, ... , 7FFFFFFFH (hexadecimal numbering system)
A 4-byte int can thus store 4,294,967,296 (100000000H) different values. To demonstrate the difficulties that arise when the storage capacity of an int variable is exceeded,
program Game.java is also executed with an exceedingly large input value in the program
description. The computer tries to increment the value 2,147,483,647 which is stored in a
4-byte int variable. This results in the number -2,147,483,648 and not in...
View Full Document
- Winter '14