Arithmetic expressions in any language comprise operands and operators. For reference, x and y are used as operands having values 10 and 20, respectively. The following table shows the precedence order:
In an arithmetic expression, generally, the rule of Bracket, Of, Division, Multiplication, Addition, and Subtraction (BODMAS) is followed, and operators have their own precedence order. Exponentiation enjoys a higher precedence order, while addition and subtraction have a lower precedence order.
The decreasing precedence order is as follows:
Exponent
Unary negation
Multiplication, division, modulus
Addition, subtraction
If operands are of the same data type, then the resulting value is also of that type. However, addition of two int data types can produce a long integer.