Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Findbugs checks this rule for type String.

Related Guidelines

...

CWE-595 "Comparison of Object References Instead of Object Contents"

...

 

CWE-597 "Use of Wrong Operator in String Comparison"

The Elements of Java Style

Rule 79: Use equals(), not ==, to test for equality of objects

Bibliography

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b34360ab50636034-17e34e23-476348c0-ac7aabc2-58932120cad6923607c7a8aa"><ac:plain-text-body><![CDATA[

[[FindBugs 2008

AA. Bibliography#FindBugs 08]]

ES: Comparison of String objects using == or !=

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7db87d36daadc6fe-6b82f34c-4c5f40db-93ef8c21-fafcafb665acfae3a17a04fe"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

[§3.10.5, "String Literals"

http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.5]

]]></ac:plain-text-body></ac:structured-macro>

 

§5.6.2, "Binary Numeric Promotion"

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="193c6ce3-88f8-4f35-9cd1-18225533ce50"><ac:plain-text-body><![CDATA[

[[Rogue 2000

AA. Bibliography#Rogue 2000]]

Rule 79: Use equals(), not ==, to test for equality of objects

]]></ac:plain-text-body></ac:structured-macro>

...

      02. Expressions (EXP)      EXP02-J. Use the two-argument Arrays.equals() method to compare the contents of arrays