This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 2,147,483,648.
To explain this strange behavior of the program, we must remember that the memories of
computers can contain only non-negative binary numbers. Negative numbers are represented so that some positive values stored in memory are considered as negative numbers.
For example, the value 2,147,483,648 is treated as -2,147,483,648. The values that can be
contained in 4-byte int variables have the following meanings:
VALUE IN MEMORY MEANING IN PROGRAM 2,147,483,648
(7FFFFFFFH) Figure 5-1 shows how the variables of program Game.java look like in the main
memory of a computer, and how the values of the variables change when the program is
executed with input value 1234. A variable declaration like
int integer_from_keyboard ; reserves four bytes from contiguous memory locations somewhere in the main m...
View Full Document
- Winter '14