Reputation:
I have this small piece of simple code but I don't know why I can't get it to work:
tagName="Hello";
String value="Hello";
if (tagName!=null && tagName.equals(value))
{
int io=0;
}
tagName
is not null
and clearly equals to value
but the code never hits the line int io=0
.
Upvotes: 0
Views: 108
Reputation: 100051
Java may optimize out your assignment statement because it has no effect. You can put a System.out.println into that block, or you can move 'int io' to outside the if and just have an assignment inside the block.
Upvotes: 8