The following list summarizes the important points about operators that were covered in this module:
- The postfix operators
++
and --
return the value of a variable before incrementing or decrementing it.
- The unsigned right shift operator
>>>
always shift's in zero bits for high-order bits.
- The operators
&&
, ||
, and ?:
may not evaluate all operands before returning a value.
- Numeric promotion is used with unary and binary numeric operators.
- When a
String
object appears as an operand to the +
operator, the other operand is automatically converted to a String
object.
- Casting is used to convert numeric values and object references prior to assignment.
- The
==
and !=
operators are used to compare object references, not object values.
- The
equals()
method of the Object
class is used to compare objects by value.
- The simple assignment operator does not cast numeric values, however the assignment operators that perform binary arithmetic do cast numeric values before assignment.
- The simple assignment operator is right-associative and returns the value of an assignment.
- Expressions are evaluated based on the use of parentheses, operator precedence, and operator associativity.