1 & Logic with : False if False.
| logical OR : true if True.
^ Logical XOR : The same is false, and the difference is true.
Example: Couple relationship. Male, female, male, female
The logical non : False is true, and false if not true.
Features: An even number does not change itself.
2
the difference between && and &? and | The difference?
A: The end result is the same.
The b:&& has a short circuit effect. The left side is false and the right side is not executed.
1 classOperatorDemo2 {2 Public Static voidMain (string[] args) {3 intA = 3;4 intb = 4;5 intc = 5;6 7 //&& Double and8System.out.println ((a > B) && (a > C));//false && false = False9System.out.println ((a > B) && (a < C));//false && true = FalseTenSystem.out.println ((a < b) && (a > C));//true && false = False OneSystem.out.println ((a < b) && (a < C));//true && true = True ASystem.out.println ("----------------"); - - intx = 3; the inty = 4; - - //Boolean B1 = ((x + = = 3) & (y++ = = 4)); - //Boolean B1 = ((x + = = 3) && (y++ = = 4)); + //Boolean B1 = ((++x = = 3) & (y++ = = 4)); - BooleanB1 = ((++x = = 3) && (y++ = = 4)); +System.out.println ("x:" +x); ASystem.out.println ("Y:" +y); at System.out.println (B1); - } -}
Logical operators for Java Note 5 and differences between && and &