Java Reference
In-Depth Information
}
}
value is 10
a1 is 4
a2 is 12
a1 is 4
a2 is 4
a1 is 4
a2 is 32
a1 is 4
a2 is 2
a1 is 4
a2 is 0
Increment and Decrement Operator
Java provides two very important operators i.e increment and decrement operators having
syntax ++ and - respectively.
These operators are specific types of assignment operators with following fea-
tures
Unary operators working with a single operand.
Increment operator increases the value of the operator to which it is
applied by 1
Decrement operator decreases the value of the operator to which it is
applied by 1
There are two versions of these operators:
Preincrement and predecrement operator
Postincrement and postdecrement operator