Arithmetic Operators Example
- /*
- Arithmetic Operators Example
- This example shows how to use Java Arithmetic operators like + (addition),
- - (subtraction), * (multiplication) and / (division).
- */
- public class ArithmeticOperatorsExample {
- public static void main(String[] args) {
- System.out.println("Arithmetic operators example :");
- int i = 50 + 20;
- int j = i - 10;
- int k = j * 2;
- double l = k / 6;
- System.out.println("i = " + i);
- System.out.println("j = " + j);
- System.out.println("k = " + k);
- System.out.println("l = " + l);
- }
- }
- /*
- Output would be
- Arithmetic operators example :
- i = 70
- j = 60
- k = 120
- l = 20.0
- */



