
Introduction to Operators and Expression in Java • 61
“+(x)+” “+(x++)+” “+(x--));
}
}
OUTPUT:
BEHAVIOUR OF ++ AND -- OPERATOR
9 10 10 10 11
Explanation: The evaluation takes place from left to right. This is shown in the following steps:
1. In 22x, fi rst x is decremented and then printed, so the output is 9 and the same for the next
expression.
2. In 11x, fi rst x is incremented and then printed, so the output is 10 and the same for the next
expression.
3. In x, value of x is printed, so the output is 10 and the same for the next expression.
4. In x11, fi rst x is printed and then incremented, so the output is 10 and 11 for the ...