Operators are special symbols that perform operations on variables and values, known as operands. For instance, in the arithmetic operation 5 + 3
, 5
and 3
are operands, while +
is the operator.
Operands are the entities on which operators act to perform various tasks. In an expression like 5 * 4
, both 5
and 4
serve as operands to the multiplication operator *
.
An expression combines operands and operators to produce a result. For example, the expression a + b - c
involves operands (a
, b
, c
) and operators (+
, -
) and yields a result upon evaluation.
int num1 = 9;
int num2 = 5;
// Addition
int addResult = num1 + num2; // Result: 14
// Subtraction
int subResult = num1 - num2; // Result: 4