Operators that act upon two operands are referred to as Binary Operators. The operands of a binary operator are distinguished as the left or right operand. Together, the operator and its operands constitute an expression.

4 + 20 result in 24.

A + 5 (where a = 2) result in 7.

A + b (where a = 4, b = 6) result in 10.

Its operands may be of integer (byte, short, char, int, long) or float (float, double) types.

14 – 3 evaluates to 11

A – b (where a = 7, b = 5) evaluates to 2.

The operands may be of integer or float types.

3 * 4 evaluates to 12.

b * 4 (where b = 6) evaluates to 24.

a * c (where a = 3, c = 5) evaluates to 15.

The operands may be of integer or float types.

100 / 5 evaluates to 20.

a / 2 (a = 16) evaluates to 8.

a / b (a =15.9, b = 3) evaluates to 5.3.

The operands may be of integer or float types.

19 % 6 evaluates to 1, since 6 goes into 19 three times with a reminder 1. Similarly 7.6 % 2.9 results into 1.8 and – 5% -2 result into -1.

**Addition operator (+)**. The arithmetic binary operator ads the values of its operands and the result is the sum of the values of its operands and the result is the sum of the values of its two operands. For example,4 + 20 result in 24.

A + 5 (where a = 2) result in 7.

A + b (where a = 4, b = 6) result in 10.

Its operands may be of integer (byte, short, char, int, long) or float (float, double) types.

**Subtraction operator (-)**. The – operator subtracts the second operand from the first. For example,14 – 3 evaluates to 11

A – b (where a = 7, b = 5) evaluates to 2.

The operands may be of integer or float types.

**Multiplication operator (*)**. The * operator multiplies the values of its operands. For example,3 * 4 evaluates to 12.

b * 4 (where b = 6) evaluates to 24.

a * c (where a = 3, c = 5) evaluates to 15.

The operands may be of integer or float types.

**Division operator (/)**. The / operator divides its first operand by the second. For example,100 / 5 evaluates to 20.

a / 2 (a = 16) evaluates to 8.

a / b (a =15.9, b = 3) evaluates to 5.3.

The operands may be of integer or float types.

**Modulus operator (%)**. The % operator finds the modulus of its first operand relative to the second. That is, it produces the remainder of dividing the first by the second operand. For example,19 % 6 evaluates to 1, since 6 goes into 19 three times with a reminder 1. Similarly 7.6 % 2.9 results into 1.8 and – 5% -2 result into -1.

## 0 comments:

## Post a Comment