逻辑运算符
package operator;
public class Demo05 {
//逻辑运算符
public static void main(String[] args) {
boolean a = true;
boolean b = false;
System.out.println("a && b:"+(a&&b));//逻辑与运算,真真才真
System.out.println("a || b:"+(a||b));//或运算,有真则真
System.out.println("!(a && b):"+!(a&&b));//真则假 假则真
//短路运算
//:如果为假 则后面不会执行
// eg
int c = 4;
boolean d = (c<4)&&(++c<10);
System.out.println(c);
System.out.println(d);
}
}
毛主席说过:前途是光明的,道路是曲折的
我i们要 下定决心,不怕牺牲,排除万难,争取胜利
加油 加油 加油
浙公网安备 33010602011771号