+ 1

Please I need a well and detailed explanation on "The equals() method"

like how to write a code on equals()method (preferably on phone), and it uses

18th Feb 2018, 2:49 PM
Fakorede Damilola
4 Réponses
+ 8
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. https://www.javatpoint.com/java-string-equals
18th Feb 2018, 2:51 PM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 2
Ok thank you,but there is one that I don't understand the name is 'equals()' it source code is really long.It like on the second page please like does it have a different use other than the one you just stated
18th Feb 2018, 2:54 PM
Fakorede Damilola
+ 2
equals() function is inherited (implemented proper term) from Object class. If you override it, it allows you to define your own method of comparing two different objects. For example, you have a Animal class. You can override equals, on every class that extends Animal, so you can compare a Bird with other birds for their featherColors, or a Cat with other cats for their breedName.
18th Feb 2018, 4:07 PM
Hugo Puyol
Hugo Puyol - avatar