131,895 views
32 votes
32 votes
The equals method of the Object class returns true only if the two objects being compared:_________

a) have identical attributes.
b) are the same object.
c) are aliases of each other.
d) are == to each other.
e) All of these are correct.

User Marco Caltagirone
by
2.6k points

1 Answer

29 votes
29 votes

Answer:

Option b) are the same object.

Step-by-step explanation:

The equals is used to compare the two objects based on the equality of the objects and if they share the same memory address. Thus the same objects will return the same memory address in which case method requires true.

== and equals method are different in terms of comparison, identical attributes may not lead to the output being true.

User Beckettsean
by
2.8k points