- Back to Home »
- java , notes , school »
- ICSE 10th Standard Notes – Arithmetic Operators and their precedence in Java

Wednesday, 5 February 2014

## ICSE 10th Standard Notes – Arithmetic Operators and their precedence in Java

### Arithmetic Operators :

Java provides five Arithmetic Operators. The Arithmetic Operators in Java are :**Operator : + Addition**Use : a+b

**Operator : - Subtraction**Use : a-b

**Operator : * Multiplication**Use : a*b

**Operator : / Division**Use : a/b

**Operator : % Modulus**Use : a%b

The Arithmetic operators are divided into to categories namely :

**Unary Operators and Binary Operators.**

### Unary Operators :

Operators that act on one operand are referred to as the Unary Operator.

Example : +a, -b### Binary Operators :

Operators that act upon two operands are referred to as Binary Operators.

Example : a+b, a-b, a*b, a/b, a%b

Note : The ‘+’ operators can be used to concatenate two strings.

Operators

Associability

Evaluation :

Example : a+b, a-b, a*b, a/b, a%b

Note : The ‘+’ operators can be used to concatenate two strings.

### Arithmetic Operator Precedence :

PrecedenceOperators

Associability

**1. Precedence**( ) Left to Right**2. Precedence*** / % Left to Right**3. Precedence**+ - Right to Left**Example : y=(6+4)/2*3;**
In the example first the expression in the parenthesis is evaluated, as the parenthesis has got the highest priority. As division and Multiplication have equal priority, the evaluation will be done from Left to Right.

y=(6+4)/2*3;

10/2*3

5*3

15

Therefore the result of the expression will be 15.

10/2*3

5*3

15

Therefore the result of the expression will be 15.

ICSE 10th Standard Notes – Increment and Decrement Operators in Java

ICSE 10th Standard Notes – Some Operators in Java

ICSE 10th Standard Notes – Relational Operators in Java

ICSE 10th Standard Notes – Shift and Bitwise Operator in Java

ICSE 10th Standard Notes – Constants and Operators in Java

ICSE 10th Standard Notes – Expressions in Java

ICSE 10th Standard Notes – Assignment and Shorthand Operator in Java

ICSE 10th Standard Notes – Statements in Java

ICSE 10th Standard Notes – Variables in Java

ICSE 10th Standard Notes – Boolean Expressions in Java

ICSE 10th Standard – Comment Statements in Java

ICSE 10th Standard Notes – Escape Sequences in Java