package com_lei;
/**
*
- 逻辑运算符
- @author lei
*/
public class test_39 {
public static void main(String[] args) {
boolean b1 = true;
boolean b2 = false;
System.out.println(b1 & b2);// &=与——&&=与
//两个操作为true,结果才是true,否则为false;
System.out.println(b1 || b2);// |=或\或者——||=或\或者
//两个操作数有一个是false,结果就是true;
System.out.println(b1 ^ b2);// ^=亦或\亦或者
//相同为false,不同为true;
System.out.println(!b2);// !=非\取相反的
//false为true;ture为false;
//test_短路;
//报错————iont c = 3/0;——0不能做除数;
boolean b3 = 1 > 2 && 2 <(3/0);
//短路与,第一个操作的值为false,则不需要计算后面的操作数;
System.out.println(b3);
}
}