The expression obj.equals(null)
will always be false.
The program uses the equals()
method to compare an object with null
. This comparison will always return false, since the object is not null
. (If the object is null, the program will throw a NullPointerException
).
[1] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 398, CWE ID 754
[2] JavaDoc for Object Sun Microsystems
[3] Standards Mapping - SANS Top 25 2010 - (SANS 2010) Risky Resource Management - CWE ID 754