APPENDIX B

JAVA OPERATOR SUMMARY

The Java operators are listed in groups of decreasing precedence in the table below. The horizontal lines in the table indicate a change in operator precedence. Operators with higher precedence bind more strongly than those with lower precedence. For example, x + y * z means x + (y * z) because the * operator has higher precedence than the + operator. Looking at the table below, you can tell that x && y || z means (x && y) || z because the || operator has lower precedence.

The associativity of an operator indicates whether it groups left to right, or right to left. For example, the - operator binds left to right. Therefore, x - y - z means (x - y) - z. But the = operator binds right to left, and x = y = z means x = (y = z).

image

image

Get Java For Everyone: Compatible with Java 5, 6, and 7, 2nd 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.