<p>I was really confused about the .equals(), .compareTo() and ==<br>
What’s the difference between them and where do i use them specifically?</p>
<p>This is the best detailed one i could find… .</p>
<p>[Java:</a> ==, .equals(), compareTo(), and compare()](<a href=“http://leepoint.net/notes-java/data/expressions/22compareobjects.html]Java:”>http://leepoint.net/notes-java/data/expressions/22compareobjects.html)</p>
<p>In short, .equals() compares content, == compares reference, .compareTo() compares order.</p>
<p>actually, if you don’t override the equals() method, it is exactly the same as the == operator. they both will indicate whether two objects references refer to the same memory location.</p>
<p>A example would be when you comparing two strings, the == operator will just check if its the same reference, while the equals() method will check if they are equal.</p>