http://www.verejava.com/?id=16992598459515
public class operation4{public static void Main (string[] args) {//Logical Operations/* Includes: With && (and), or | | (OR) Not! 1. && returns the result to True when both sides of the operation are true, otherwise false 2. || Returns false if both sides of the operation are false, otherwise true; 3.! Inverse, the operation is true to return the result false, otherwise true */System.out.println (true&&false); System.out.println (false&&true); System.out.println (False&&false); System.out.println (true&&true); System.out.println ("---------------"); System.out.println (true| | FALSE); System.out.println (false| | true); System.out.println (true| | true); System.out.println (false| | FALSE); System.out.println ("---------------"); System.out.println (!true); System.out.println (!false); ! is the monocular operation//system.out.println (True!false); System.out.println ("----------------"); Boolean b=true; System.out.println (b); System. Out.println (1>2&& (b=3>4)); System.out.println (b); System.out.println (2>1&& (b=3>4)); System.out.println (b); */* NOTE: && short-circuit characteristics: Because the program is from the top down, from left to right, when judging the left is false when the return of && is doomed to be false, so the subsequent judgment of the computer Will not be carried out. */System.out.println ("--------------"); Boolean b1=true; System.out.println (B1); System.out.println (2>1| | 3>4); System.out.println (2>1| | (b1=3>4)); System.out.println (B1); System.out.println (1>2| | (b1=3>4)); System.out.println (B1); /* Note: | | Short-circuit Characteristics: Because the program is executed from left to right, when judging the left is true the return result is doomed to be true, so the subsequent judgment computer does not execute */}}
http://www.verejava.com/?id=16992598459515
Logical operation of Java Foundation