|
| |

Left associative

Binary operators + and - are called left associative in Java because a sequence of them is carried out in left-to-right fashion. For example,

b+ c - d + f     is equivalent to     ((b+ c) - d) +f

Right associative

Unary operators - are called right associative because a sequence of them is carried out in right-to-left fashion. For example,

- - - 5     is equivalent to      - (- (- 5))

Associative

In math, an operator is called associative if it doesn't matter what order sequences of them are carried out. For example, + is associative because

(b+c) + d    and    b + (c+d)

give the same result.

 
© 2002 Copyright Cornell University