Java Logical Operators Bitwise operators and

Logical operators: &, &&, |, ||;
&: logical AND, & Article 1 Article 2, when a condition is false, then the whole to false;
&&: logical AND, Article 1 Article 2 && when the first condition is false, the whole is false; otherwise, the second test condition.
A first condition determination program, then the condition 2 is determined. Our logic and understanding should be, as long as there is false is false.
Then when a condition is found false, the determination condition 2 is not necessary.
Therefore && role is 1 when the condition is false, skip condition 2, directly false.
And short-circuit a bit like physics, && it may also be referred to as "short-circuiting"
|, ||; same appreciated that a short circuit or condition 1 is true, skip condition 2, direct true.

Bitwise operators:
the data on the two binary numbers, the corresponding position compared.
&: 0 is 0, Examples 110 and 101, a first second 1 0 third 0, the result 100;
|: YES 1 1, (and logic or, if there are true true, a understood idea)
^ : 1 with different 0
": 2; Example 3" 3,3 2 2 2, on the left by a few number of 2
": / 2; ibid contrary.

Guess you like

Origin www.cnblogs.com/jinzou/p/12315365.html