Java String equals()The java string equals() method compares the two given strings based on the content of the string. If any character is not matched, it returns false. If all characters are matched, it returns true. The String equals() method overrides the equals() method of Object class. Internal implementationSignatureParameteranotherObject : another object i.e. compared with this string. Returnstrue if characters of both strings are equal otherwise false. Overridesequals() method of java Object class. Java String equals() method exampletrue false false Java String equals() Method Example 2The equals() method compares two strings and can be used in if-else control structure. true both strings are unequal Java String equals() Method Example 3Let's see one more example to test the equality of string present in the list. Mukesh is present Next TopicJava String equalsIgnoreCase()
|