Why do classes need an equals method?

The equals() method compares two objects for equality and returns true if they are equal . The equals() method provided in the Object class uses the identity operator ( == ) to determine whether two objects are equal. For primitive data types, this gives the correct result.

Sizin İçin Seçtik  What is an object How is it created?

Leave a Reply

Your email address will not be published. Required fields are marked *