What is the difference between == and equals() in Java?
In general, the answer to your question is “yes”, but… .equals(…) will only compare what it is written to compare, no more, no less. If a class does not override the equals method, then it defaults to the equals(Object o) method of the closest parent class that has overridden this method. If no parent classes have provided an … Read more