First lists all the arithmetic operators
Step Two:
Precautions:
When we use arithmetic operators, remember that the following things are important:
1. The addition operator should be aware that when connecting strings, it is only possible to add strings directly to the string.
2. Division "/" when the two sides are integers, take the integer part, the remainder. When one side is floating-point, divide by normal rule.
3."%" is the divisible-by-remainder symbol, and the fractional remainder is meaningless. The result symbol is the same as the remainder symbol.
4. integer do dividend, 0 can not do divisor, otherwise error.
What is the difference between the self-increment (decrement) operator above and the previous and subsequent variables?
- Used alone:
- Put it in front and back of the variable, just like the example above
- Participate in the operation using:
- Put in front of the variable, increment or decrement it first, and then participate in the operation.
- At the back of the variable, first participate in the operation, and then self-increment or decrement.
Examples:
Arithmetic operators for Java operators