Java Day02

public class Demo04 {
   public static void main(String[] args) {
       //也就是说一个数,等于真(true),即其值为真,反之为假
       int score = 80;
      String type = score <60?"不及格":"及格";
       System.out.println(type);
  }
}
public class Demo03 {
   public static void main(String[] args) {
       //逻辑运算符
       //与(and) 或(or) 非(取反)
       boolean a =true;
       boolean b =false;
       System.out.println("a && b:"+(a&&b));//逻辑与运算:两个变量都为true,结果才为true
       System.out.println("a || b:"+(a||b));//逻辑或运算:两个变量有一个为teue,结果才为true
       System.out.println("! (a && b):"+!(a&&b));//如果是true,则为false,如果是false,则为true
  }
}

 向左*向右/

即:

2*8 = 16        2*2*2*2

<< *2

>> /2

posted @ 2021-02-06 14:26  静眠  阅读(31)  评论(0)    收藏  举报