Logical operators:
Logic and:&&
Logical OR: | |
Logical non-:!
Note: Logic and logic or the use of short-circuit methods. From left to right, if the determined value is no longer evaluated.
Eg:boolean c =1>2 && 2> (3/0); && does not report abnormal errors, stating that no 3/0 is executed;
Bitwise operators:
~ Reverse: 0 to 1 1 to 0
& Bitwise AND: 00 to 0, 01 to 0, 10 to 0, 11 to 1
| bitwise OR: 00 to 0, 01 to 1, 10 to 1, 11 to 1
^ Bitwise XOR: 00 to 0, 01 to 1, 10 to 1, 11 to 0 (same as 0, 1)
<< left shift operator: Shift left one is equivalent to multiply by 2.
>> Right shift operator: Move right one is equivalent to 2 fetch. (It is important to note that exams may be multiplied by 4 for the fastest or the most efficient by 4)
Expansion operators:
int A;
A + = 5; Equivalent to a = a +5;
a-=5; Equivalent to a = a-5;
a *=5; Equivalent to a = a*5;
a/=5; Equivalent to a = A/5;
A%=5//equivalent to a =a%5;
Java Learning notes-logical operators, bitwise operators, extension operators