# Operators in Java

In the chapter we are going to learn about basic Operators we use in the Java language.

List of Operators are:

- Arithmetic Operators.
- Assignment Operators.
- Comparison Operators.
- Conditional Operators.

# Assignment Operator:

Assignment Operator is used to Assign (store) the value into the variable, the Operator symbol used to store value is ‘=’.

# Arithmetic Operators :

Arithmetic Operators are used to do the math calculations like Addition, subtraction, Division, Multiplication the Operator symbols are ‘+’, ‘-‘, ‘*’, ‘/’ and % .

Example program for Arithmetic Operators and Assignment Operations:

class ArithmeticOperations{ public static void main(String[] args){ int a,b,c,d,e,f,g; //Assignment Operations a=50; b=10; //Arithmetic Operations c=a+b; d=a-b; e=a/b; f=a*b; g=a%b; System.out.println("Sum of "+a+" and "+b+" is :"+c); System.out.println("Subtraction of "+a+" and "+b+" is :"+d); System.out.println("Division of "+a+" and "+b+" is :"+e); System.out.println("Multiplication of "+a+" and "+b+" is :"+f); System.out.println("Reminder of "+a+" and "+b+" is :"+g); } }

# Comparison Operators:

Comparison Operators are used to compare the values stored in the different variables.Symbols for comparison Operators are ‘==’, ‘!=’, ‘>’, ‘<', '<=', '>=’ .

# Conditional Operators:

Conditional Operators are two those are ‘&&'(and), ‘||'(or).

It checks the two conditional statements. evaluation based on chosen operator && or ||

Let us consider two statements ‘A’ and ‘B’. for this Operations as follows

#### For && Operator:

- If ‘A’ and ‘B’ are True then it returns True.
- If ‘A’ and ‘B’ are False then it returns False.
- If ‘A’ is True and ‘B’ is False then it returns False.
- If ‘A’ is False and ‘B’ is True then it returns False.

#### For || Operator:

- If ‘A’ and ‘B’ are True then it returns True.
- If ‘A’ and ‘B’ are False then it returns False.
- If ‘A’ is True and ‘B’ is False then it returns True.
- If ‘A’ is False and ‘B’ is True then it returns True.

Example for the Conditional and Comparison Operator is Given below: