Of the logical operators in Java, there are four classes && (short circuit and), & (with), | | (short-circuit or), | (non-shorted or)
&& and & both indicate that with,&&, when the first condition is false, subsequent conditions do not execute,& to judge all conditions
|| and | Both Express or, | | Indicates that the first condition is true, and the following conditions are not judged; | To judge all the conditions
1 if((23>24) && (100/0==0)) {//23>24 is false, the following conditions do not perform the judgment, when 23<24 is true, the following conditions continue to execute the judgment, throwing an exception java.lang.ArithmeticException:/by Zero2 }3 if((23>24) & (100/0==0)) {//the condition must be judged, throw exception java.lang.ArithmeticException:/by Zero4 }5 if((23<24) | | (100/0==0)) {// || Short circuit or, when the first condition is true, the latter condition does not perform judgment;6 }7 if((23>24) | (100/0==0)) {//| non-shorted or, all conditions must be judged8}
Four logical operators of Java