This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Th only difference between those two is that we can't see how you declare x and y in the second one, although I can't imagine any declaration that would cause it to print true.
Why don't you show us how you are declaring x and y and how you are calling these two pieces of code.
Vishal Kashyap wrote:...but, as we can see; you have not clearly shown declaration statement...
Anyway does the declaration statement really matter? (x && y) immediately follows clear boolean assignments to x and y. 'false' can be expected only when there is something else between the assignment and the expression.
The point is we don't *know* what's there--the two chunks could be completely unrelated and in different files, or there might be no separation between the two chunks at all. Since the claim that the behavior of boolean "and" is broken, there's obviously more information needed, because it's extremely unlikely "and" is broken.