2.3 Data Types, Typing, Variables, and Assignments
As is typical for imperative programming languages, Java uses variables to store data. A variable is a reserved memory area and—depending on the content—occupies a fixed number of bytes. All variables (and also expressions) have a type that is known at translation time. The type is also called a data type because a variable contains a data value. Examples of simple data types are integers , floats , truth values, and characters . The type also determines the allowed operations because truth values can’t be added, for example, whereas integers can. In contrast, floats can be added, but not linked via XOR. Since each variable has a fixed data type specified by the programmer, which is known ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access