Package jack.test; /** * Sometimes look at the open source framework can learn a lot of useful things, see the simple log when you find a writing * in the Boolean operation can be used |= or &= or ^= operations. * Logical operator * The Operation object and result of the logical operator are all Boolean type, total six: *. (logical non) && (logic and) | | (logical OR) * ^ (Logical AND/) & (Logic and) | (Logical OR) * Bitwise AND ' & ' can also be used as logic and use, but not optimized, while ' && ' operators are optimized. To ' | ' Operators are similar. * @author Administrator * * */public class Test {public static void main (string[] args) {Boolean isTrue = false; IsTrue | = true; System.out.println (isTrue); IsTrue = false; IsTrue |= false; System.out.println (isTrue); IsTrue = true; IsTrue |= true; System.out.println (isTrue); IsTrue = true; IsTrue |= false; System.out.println (isTrue); IsTrue &= false; System.out.println (isTrue); IsTrue = true; IsTrue ^= isTrue; System.out.println (isTrue); } }