- Arithmetic operators
- Assignment operators
- Comparison operators
- logical operators
- Bitwise operators
- Ternary operators
Arithmetic operators
Special Case -2%5=-2;2%-5=2
When a negative number appears in the modulo operation, the positive or negative of the result is the same as the positive or negative of the modulus (the left digit).
The ingenious use of molds:
- Any number%2, the result is only two cases, not 1 is 0, can realize the effect of similar switch
- The result of modulo operation must be less than modulus, thus can skillfully realize the control of the digital range
For example, if you want to control the range of a result within 10, you can use a modulus of 10, the result must be less than 10
- + + self-increment to +1 of the original data
- + string connector becomes a connector only if a string is involved
Assignment operators
Java Novice Path--day05 operator