### Types and Examples of Operators in Java Programming part-1

In Java programming, the operations (specific tasks) are represented by operators and the objects of the operations (s) are referred to as operands.

Java’s rich set of operators comprise of arithmetic, relational, logical and certain other type of operators. Let us discuss these operators in detail.

For example

if a = 5 then +a means 5.

if a = o then +a means 0.

If a = -4 then +a means -4.

For example

If a = 5 then –a means -5

if a = o then +a means 0. (There is no quantity known as -0)

If a = -4 then +a means -4.

This operators reverse the sing of the operand’s value.

Binary Operators

Java’s rich set of operators comprise of arithmetic, relational, logical and certain other type of operators. Let us discuss these operators in detail.

#### Arithmetic Operators

To do arithmetic, Java use operators. It provides operators for five basic arithmetic calculations: addition, subtraction, multiplication, division and remainder which are +, -, *, / and % respectively. Each of these operators is a binary operator i.e., it requires two values (operands) to calculate a final answer. A part from these binary operators, Java provides two unary arithmetic operators (that require one operand) also which are unary +, and unary -.#### Unary Operators

Operators that act on one operand are referred to us as Unary Operators.**Unary +.**The operators unary ‘+’ precedes an operand. The operand (the value on which the operator operates) of the unary + operator must have arithmetic type and the result is the value of the argument.For example

if a = 5 then +a means 5.

if a = o then +a means 0.

If a = -4 then +a means -4.

**Unary-.**The operator unary – precedes an operand. The operand of the unary – operator must have arithmetic type and the result is the negation of its operand’s value.For example

If a = 5 then –a means -5

if a = o then +a means 0. (There is no quantity known as -0)

If a = -4 then +a means -4.

This operators reverse the sing of the operand’s value.

Binary Operators

## Comments

## Post a Comment