Classes/Objects  «Prev  Next»


Lesson 9

Java Operator Conclusion

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

Key Terms and Concepts

  1. Cast: To convert from one type to another.
  2. Short-circuit: A boolean operation in which one operand determines the result of the operation. z
  3. Numeric promotion: The conversion of numeric values to a larger type to support operations on that type.
  4. Right associative: Operations that are right associative are performed in a right to left manner. That is, x op y op z is evaluated as x op (y op z).
  5. Left associative: Operations that are left associative are performed in a left to right manner. That is, x op y op z is evaluated as (x op y) op z.
  6. Precedence: The order in which operations are performed.

Java Output Operator - Exercise

Click the Exercise link below to check your understanding of Java operators.
Java Output Operator - Exercise

Java Operators - Quiz

Click the Quiz link below to check your understanding of Java operators.
Java Operators - Quiz