public class Demo5 {
public static void main(String[] args) {
boolean b= false;
boolean a= true;
System.out.println("a&&b:"+(a && b));//全真为真
System.out.println("a||b:"+(a || b));//有真为真
//注意: 逻辑运算符的短路 当&&运算时,前者为假则不运算后者
//+为字符串连接符 出现在前面 后面的运算进行拼接 出现在后面则不会
int a1=3;
int a2= 4;
System.out.println(""+a1+a2);
System.out.println(a1+a2+"");
int c =3;
boolean d =(c<2&&c++<4);//因为c<2为假 ,所以不再计算c++
boolean e =(c<4||c++<4);//因为c<4为真 ,所以不再计算c++
boolean f =(c<3||c++<4);//因为c<3为假 ,所以计算c++
System.out.println(d);
System.out.println(c);
System.out.println(e);
System.out.println(c);
System.out.println(f);
System.out.println(c);
}
}