
! 8
Chapter 2: Basic Language Syntax []
a2=3c=3
a3=ld=2
a4=le=l
This idea is extended by the +=, -=, *=,/=, and %= operands to combine an operation with
an assignment. Thus,
a += 2 is equivalent to a = a + 2
a -= 2 is equivalent to a = a - 2
a *= 2 is equivalent to a = a * 2
a /= 2 is equivalent to a = a / 2
a %= 2 is equivalent to a = a % 2
When an expression consists of two or more operators, Java applies rules of precedence
about which operand is applied first. Operands with a higher precedence are applied before
those of a lower precedence. The operands *, /, and % are of equal precedence, ...