public class OpterDemo {
public static void main(String[] args) {
System.out.println(true&true);
System.out.println(true&false);
System.out.println(false&true);
System.out.println(false&false);
//运行结果为true;false;false;false
//遇false则false
System.out.println(true|true);
System.out.println(true|false);
System.out.println(false|true);
System.out.println(false|false);
//运行结果为true;true;true;false
//遇true则true
System.out.println(!true);
System.out.println(!false);
//运算结果为false;true
System.out.println(true^true);
System.out.println(true^false);
System.out.println(false^true);
System.out.println(false^false);
//运算结果为false;true;true;false
//相同的为false,不同的为true
int x=3;
int y=5;
boolean resunt=++x>3&&y--<5;
int a=3;
int b=5;
boolean scent=++x>3||y--<5;
}
}
标签:逻辑,false,int,System,运算符,println,true,out
From: https://blog.51cto.com/u_15988249/6155677