codemistic / Data-Structures-and-Algorithms

A repository to help the open-source community with DSA related contributions
MIT License
327 stars 334 forks source link

Codex1616/override equals method #634

Closed codeX1616 closed 1 year ago

codeX1616 commented 1 year ago

This code compares two instances of class Abc by overriding the equals method of Object.class. If the equals method is directly used without overriding, the program would return "Both objects are unequal" even if they are equal as Object.equals() compares the reference of the objects as well. However, this code should return "Both objects are equal".