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 ...
Get Java: An Introduction to Problem Solving and Programming, 8th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.