Java : What's the difference between the == operator and the object.equals() method? What test does

The == operator would be used, in an object sense, to see if the two
objects were actually the same object. This operator looks at the
actually memory address to see if it
actually the same object. The equals() method is used to compare the
values of the object respectively. This is used in a higher level to
see if the object values are equal.
Of course the the equals() method would be overloaded in a meaningful
way for whatever object that you were working with.

No comments:

Post a Comment