## Arithmetic Operators in Java

Java Arithmetic Operators in provides the ability to perform Mathematical Arithmetic operations in Java programming.

The following are the list of Arithmetic Operations supported in Java.

• Subtraction
• Multiplication
• Division
• Modulus
• Increment (Pre-Increment, Post-Increment)
• Decrement (Pre-Decrement, Post-Decrement)

### Arithmetic Operators that require two operands

Out of the seven arithmetic operators, that java provides, the operators mentioned in the below table require two operands to perform the arithmetic operation.

### Example

Now, let us see the demonstration of arithmetic operators with an Example Java Program, ArithmeticOperatorsExample.java.

Main.java

```public class Main {
public static void main(String[] args) {
int a = 10;
int b = 5;

System.out.println("Addition :       (a + b) = " + (a + b));
System.out.println("Subtraction :    (a - b) = " + (a - b));
System.out.println("Multiplication : (a * b) = " + (a * b));
System.out.println("Division :       (a / b) = " + (a / b));
System.out.println("Modulus :        (a % b) = " + (a % b));
a = 10;
System.out.println("During Post-Increment :   a = "+(a++));
System.out.println("After  Post-Increment :   a = " + a);
a = 10;
System.out.println("During Pre-Increment :    a = " + (++a));
System.out.println("After  Pre-Increment :    a = " + a);
a = 10;
System.out.println("During Post-Decrement :   a = "+(a--));
System.out.println("After  Post-Decrement :   a = " + a);
a = 10;
System.out.println("During Pre-Decrement :    a = " + (--a));
System.out.println("After  Pre-Decrement :    a = " + a);
}
}```

Output

```ddition :       (a + b) = 15
Subtraction :    (a - b) = 5
Multiplication : (a * b) = 50
Division :       (a / b) = 2
Modulus :        (a % b) = 0
During Post-Increment :   a = 10
After  Post-Increment :   a = 11
During Pre-Increment :    a = 11
After  Pre-Increment :    a = 11
During Post-Decrement :   a = 10
After  Post-Decrement :   a = 9
During Pre-Decrement :    a = 9
After  Pre-Decrement :    a = 9```

### Java Arithmetic Operator Tutorials

The following tutorials provide a well detailed explanation and examples for each of the Arithmetic Operators in Java.

### Conclusion

In this Java Tutorial, we learned about different Arithmetic Operators in Java.