The operands of the arithmetic operators must be of a numeric type. you can also use them on char types, since it is a subset of int int java.
| Operator | Operation |
|---|---|
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / | Division |
| % | Modulus |
| ++ | increment |
| += | Addition assignment |
| -= | Subtraction assignment |
| *= | Multiplication assignment |
| /= | Division assignment |
| %= | Modulus assignment |
| - - | Decrement |
The modulus operator preserves the sign of the dividend.
system.out.println(8 % 3); // 2
system.out.println(8 % -3); // 2
system.out.println(-8 % 3); // -2