package demo.d2;
class RelLogOps {
public static void main(String args[]) {
int x, y;
boolean a, b;
x = 10;
y = 11;
if(x < y) System.out.println("x < y");
if(x <= y) System.out.println("x <= y");
if(x != y) System.out.println("x != y");
if(x == y) System.out.println("this won't execute");
if(x >= y) System.out.println("this won't execute");
if(x > y) System.out.println("this won't execute");
a = true;
b = false;
if(a && b) System.out.println("this won't execute");
if(!(a && b)) System.out.println("!(a && b) is true");//请帮我解释下最后三条if代码的执行原理
if(a || b) System.out.println("a || b is true");
if(a ^ b) System.out.println("a ^ b is true");
}
}
class RelLogOps {
public static void main(String args[]) {
int x, y;
boolean a, b;
x = 10;
y = 11;
if(x < y) System.out.println("x < y");
if(x <= y) System.out.println("x <= y");
if(x != y) System.out.println("x != y");
if(x == y) System.out.println("this won't execute");
if(x >= y) System.out.println("this won't execute");
if(x > y) System.out.println("this won't execute");
a = true;
b = false;
if(a && b) System.out.println("this won't execute");
if(!(a && b)) System.out.println("!(a && b) is true");//请帮我解释下最后三条if代码的执行原理
if(a || b) System.out.println("a || b is true");
if(a ^ b) System.out.println("a ^ b is true");
}
}