CHAPTER
 
4
Operators
Java provides a rich operator environment. Most of its operators can be divided into the following four groups: arithmetic, bitwise, relational, and logical. Java also defines some additional operators that handle certain special situations. This chapter describes all of Java’s operators except for the type comparison operator instanceof, which is examined in Chapter 13 and the new arrow operator (–>), which is described in Chapter 15.
Arithmetic Operators
Arithmetic operators are used in mathematical expressions in the same way that they are used in algebra. The following table lists the arithmetic operators:
Operator Result
+ Addition (also unary plus)
Subtraction (also unary minus)
* Multiplication ...

Get Java: The Complete Reference, Ninth Edition, 9th 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.