逻辑运算符
关于&&运算符的短路运算
package operator;
//逻辑运算符 与(and) 或(or) 非(取反)
public class DemoFour {
public static void main(String[] args) {
//短路运算
int a = 2;
boolean b = (a<1)&&(a++<4);//&&前的条件为false时,&&后的条件程序不会再判断
boolean c = (a<1)&&(++a<4);
System.out.println(a);//2
System.out.println(b);//false
System.out.println(c);//false
System.out.println(a);//2
}
}