Why this code prints 3 and not enter into an infinite loop?
Doesn't the while(b=!b) always evaluates to true irrespective of the value of b?I thought assignment statement as a condition always evaluates to true.
Rohan Deshmkh wrote:Why this code prints 3 and not enter into an infinite loop?
Doesn't the while(b=!b) always evaluates to true irrespective of the value of b?I thought assignment statement as a condition always evaluates to true.
And that is where the flaw is ... see section 15.26 of the JLS.