UEIOE - Use 'equals' Instead Of '=='

The '== ' operator used on strings checks if two string objects are identical. However, in most cases, one would like to check if two strings that have the same value. In these cases, the 'equals' method should be used.

Wrong

void func (String str1, String str2) {
    if (str1 == str2) {
        // do something
    }
}

Tip: Replace '==' operator with 'equals' method.

Right

void func (String str1, String str2) {
    if ( str1.equals(str2) ) {
        // do something
    }
}