Under what circumstances will the body under the condition be executed? [duplicate]
问题 This question already has answers here : Can (a==1)&&(a==2)&&(a==3) evaluate to true? (and can it be useful?) (8 answers) Closed last year . Long time ago, while being interviewed, I stumbled across this question: Suppose, somewhere, we have gotten this line of code. Could you provide at least three cases which would cause the body under the condition to be executed? if (a == 3 && a == 4) { /* ... */ } My answers were: It is quite possible that 'a' might be a custom class with overloaded