Java Reference
In-Depth Information
As you can see, the % yields a remainder of 1 for both integer and floating-point opera-
tions.
Increment and Decrement
Introduced in Chapter 1 , the ++ and the - - are Java's increment and decrement operators.
As you will see, they have some special properties that make them quite interesting. Let's
begin by reviewing precisely what the increment and decrement operators do.
The increment operator adds 1 to its operand, and the decrement operator subtracts 1.
Therefore,
is the same as
and
is the same as
Both the increment and decrement operators can either precede (prefix) or follow (post-
fix) the operand. For example,
can be written as
Search WWH ::




Custom Search