3 回答
TA貢獻1829條經驗 獲得超7個贊
(x != 0) & (1/x > 1) <-- this means evaluate (x != 0)(1/x > 1)
(x != 0) && (1/x > 1) <-- this means evaluate (x != 0)(1/x > 1)(1/x > 1).
exprA | exprB <-- this means evaluate exprAexprB|.
exprA || exprB <-- this means evaluate exprAfalseexprB||.
TA貢獻1851條經驗 獲得超3個贊
int a = 4;
int b = 7;
System.out.println(a & b); // prints 4
//meaning in an 32 bit system
// 00000000 00000000 00000000 00000100
// 00000000 00000000 00000000 00000111
// ===================================
// 00000000 00000000 00000000 00000100
TA貢獻1795條經驗 獲得超7個贊
boolean a, b;Operation Meaning Note--------- ------- ---- a && b logical AND short-circuiting a || b logical OR short-circuiting a & b boolean logical AND not short-circuiting a | b boolean logical OR not short-circuiting a ^ b boolean logical exclusive OR !a logical NOTshort-circuiting (x != 0) && (1/x > 1) SAFE not short-circuiting (x != 0) & (1/x > 1) NOT SAFE
添加回答
舉報
