Chapter Summary
A variable can hold values, such as numbers. The type of the variable must match the type of the value stored in the variable.
Variables and all other items in a program should be given names that indicate how they are used. These names are called identifiers in Java.
All variables should be given an initial value before you use them in the program. You can do this using an assignment statement, optionally combined with the variable declaration.
Parentheses in arithmetic expressions indicate the order in which the operations are performed.
When you give a value to a variable by using an assignment statement, the data type of the variable must be compatible with the type of the value. Otherwise, a type cast is necessary.
The methods ...
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