位运算

位运算

package operator;

public class Demo03 {
    public static void main(String[] args) {
        /*
        A=0011 1100
        B=0000 1100

        A&B=0000 1100
        A|B=0011 1101
        A^B=0011 0001
        ~B=1111 0011

        <<  *2
        >>/ 2
         */
    }
}

package operator;

public class Demo04 {
    public static void main(String[] args) {
        int a=10;
        int b=20;
       // a+=b;
        //a-=b;
        System.out.println(a);
        //字符串连接符 +
        System.out.println("" + a + b);
        System.out.println(a+b+"");
        //三元运算符
        /*
        x?y:z
        如果x==TRUE,则结果为y,否则结果为z
         */
        int score=90;
        String Type=score>89?"优秀":"良好";
        System.out.println(Type);
    }
}

posted @ 2022-10-13 23:10  野鬼12  阅读(20)  评论(0)    收藏  举报