Best Tutorials website


The equals() method

The equals() method

We can use the == operator to compare the values of primitive variables and determine if they are equal. However, if object reference variables are compared using the == operator, it returns true only if the reference variables are referring to the same object. To check for the equality of two objects, the Object class provides the equals(Object obj) method, which can be overridden to return true for logically equal objects.




Views: 892 | Rating star | by Nick




View this tutorial
Broken link Report broken link?