Can we compare 2 objects?

In the first comparison, equals() compares the current object instance with the object that has been passed. If the two objects have the same values, equals() will return true . In the second comparison, equals() checks to see whether the passed object is null, or if it’s typed as a different class.22 Ağu 2019

Sizin İçin Seçtik  What is the use of == in Java?

Leave a Reply

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