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 ...

Get Java™ How To Program (Early Objects), Tenth 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.