Versions Compared

Key

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

...

As a general rule, use the Object.equals() method to check whether two objects are abstractly equal to each other. Programs must reserve use of the equality operators == and != for testing whether two references specifically refer to the same object; this is reference equality. Also see rule MET09-J. Classes that define an equals() method must also define a hashCode() method.

This use of the equality operators also applies to numeric boxed types (for example, Byte, Character, Short, Integer, Long, Float, and Double), although the numeric relational operators (such as <, <=, >, and >=) produce results that match those provided for arguments of the equivalent primitive numeric types. See rule EXP03-J. Do not use the equality operators when comparing values of boxed primitives for more information.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e6e420e3ff4e2dc0-0f17995a-41834cd0-b9b1818d-c9e175e098af5681bbd9ef25"><ac:plain-text-body><![CDATA[

[[FindBugs 2008

AA. References#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="515e0b9f60ccccf5-8e057a5e-43d9494d-95c4a9a9-bd1fcbe4eeaae181cdd53a3a"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. References#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"

...