Expressions are constructed from operands and operators. The operators of an expression indicate which operations to apply to the operands. Examples of operators include +
, -
, *
, /
, and new
. Examples of operands include literals, fields, local variables, and expressions.
There are three types of operators:
–x
) or postfix notation (such as x++
).x
+
y
).?:
, exists. The ternary operator takes three operands and uses infix notation (c?
x:
y
).The order of evaluation of operators in an expression is determined by the precedence and associativity of the operators (§7.2.1).
Certain operators can be overloaded. Operator overloading permits user-defined operator implementations to be specified for operations where one or both of the operands are of a user-defined class or struct type (§7.2.2).