Java provides special shorthand assignment operators that simplify the coding of certain assignment statements. Let’s begin with an example. The assignment statement shown here
can be written, using Java shorthand, as
Ask the Expert
Q: Since the short-circuit operators are, in some cases, more efficient than their normal counterparts, why does Java still offer the normal AND and OR operators?
A: In some cases you will want both operands of an AND or OR operation to be evaluated because of the side effects produced. Consider ...