Section 2.7 Arithmetic
• The arithmetic operators (p. 51) are + (addition), - (subtraction), * (multiplication), / (division) and % (remainder).
• Integer division (p. 51) yields an integer quotient.
• The remainder operator, % (p. 51), yields the remainder after division.
• Arithmetic expressions must be written in straight-line form (p. 51).
• If an expression contains nested parentheses (p. 52), the innermost set is evaluated first.
• Java applies the operators in arithmetic expressions in a precise sequence determined by the rules of operator precedence (p. 52).
• When we say that operators are applied from left to right, we’re referring to their associativity (p. 52). Some operators associate from right to left.
• Redundant parentheses ...
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