|, &, ||, &&, ^ Symbol Meaning

| &-Bit computing and between computer binary

In the computer binary 0 represents false, 1 represents true.
| As a bit operation or operations: arithmetic logic it is a true is true, then the whole false false
& bits calculation and arithmetic: arithmetic logic it is a fake is fake, the whole truth is true


&& and || computer logical operators

|| OR operation is expressed as: its logic operation as long as the result is a true is true
&& and operation expressed as: arithmetic logic it is full only true when the result is true, similar and, on both sides and only the results are true when the final result is true


^ Is the exclusive OR operation of the computer

X 1 = int;
int Y = 2;
X = Y ^; // exclusive-OR operation, 0 is the same as a different one. The result is 3.
System.out.println ( "X =" X + ++);
binary operation process:
0. 1 0 0
0 0 0. 1
--------------
0011
the last execution ++ x, so the final output is 4.

Guess you like

Origin www.cnblogs.com/jasonboren/p/11566679.html