Java-the difference between equals and ==

Share a big cow's artificial intelligence tutorial. Zero-based! Easy to understand! Funny and humorous! Hope you join the artificial intelligence team too! Please click http://www.captainbed.net

== is a comparison operator, basic data types compare values, and reference data types compare address values ​​(that is, whether it is a reference to the same object).
equals() is a method that can only be used to compare reference data types. The address value is compared before rewriting, and the object property is generally compared after rewriting.

Guess you like

Origin blog.csdn.net/chimomo/article/details/109508513
Recommended