package operator;

public class panduan {
    public static void main(String[] args) {
        boolean a =false;
        boolean b =true;
        System.out.println(a&&b);//false 逻辑与运算:两个都为真结果才为ture
        System.out.println(a||b);//ture 逻辑或运算:两个中有一个为真结果才为ture
        System.out.println(!(a&&b));//ture 逻辑非运算:真变假,假变真
        //运算短路
        int c =5;
        boolean d =(c<4)&&(c++<10);//(c<4)为假直接不计算后边
        System.out.println(d);//false
        System.out.println(c);//5
    }
}
package operator;

public class weiyunsuan {
    public static void main(String[] args) {
        /*
      A=0011 1100
      B=0100 1001
    上下对应
    A&B=0000 1000 (都是1为1,否则为0)
    A|B=0111 1101(有1为1,无1为0)
    A^B=0111 0111(相同为0,不同为1)
     ~B=1011 0110(取反)
     */
        //2*8=16   2*2*2*2
    /*
    0000 0000    0
    0000 0001    1
    0000 0010    2
    0000 0011    3
    0000 0100    4
    0000 1000    8
    0001 0000    16
     */
        //<<左移1 *2
        //>>右移1 /2
        System.out.println(2<<3);//(效率极高!)
    }
}