java determine whether two strings are equal?

Copyright: please indicate the source https://blog.csdn.net/EdwardDrew/article/details/77482224

In programming, to determine whether the practice of using == equal, but today can not be found when doing so more java project. java comparative equals ().

Since the string is a string object, so use of the equals String (), can not be determined simply by ==.

equals () compares the contents of the object (case-sensitive format letters), but if " == to" compare two objects, the memory address comparing two objects, it is not equal. Even if they are content equal, but different memory address of the object is not the same.

Guess you like

Origin blog.csdn.net/EdwardDrew/article/details/77482224