I made a coding mistake while working on an application, it was a test for null reference. It took me hours to discover what the issue was, but what i don't understand is why the code behaved this way.
String name = null;
String value = null;
if(name != null && value != null);
{
System.out.println("Values not null");
}
The if Statement ended with ;
, that was my mistake and the Values not null
was printed even when it is obvious that both values are null. Can anybody explain why?