Results 1 to 5 of 5
- 05-26-2008, 09:40 AM #1
Member
- Join Date
- May 2008
- Posts
- 3
- Rep Power
- 0
- 05-26-2008, 11:41 AM #2
Member
- Join Date
- May 2008
- Posts
- 3
- Rep Power
- 0
The equals() method in the class Object uses only the == operator for comparisons so unless you override equals(), two objects are considered equal only if the two references refer to the same object.
- 05-26-2008, 04:25 PM #3unless you override equals(), two objects are considered equal only if the two references refer to the same object.
If i override the equals() method, i can only get a "true" if both references are only in the same object?
If it is, it depends on the new implementation....freedom exists in the world of ideas
- 05-27-2008, 10:13 AM #4
Equals is ok method. Why it belongs to Object class it's a question. You may need to check if 2 objects equals by content and not by references.
Mattery - free online strategy game
- 07-19-2008, 11:58 PM #5
Hello skyineyes
Consider the variables A and B:
Java Code:A.equals(B) is true [COLOR="RoyalBlue"][I]if and only if[/I][/COLOR] A and B references the same object.
Eyes dwelling into the past are blind to what lies in the future. Step carefully.
Similar Threads
-
Why Equals method should be over ridden in Hashcode?
By skyineyes in forum New To JavaReplies: 1Last Post: 05-26-2008, 04:13 PM -
Calling a method for all instances of an object
By rattle in forum New To JavaReplies: 4Last Post: 04-30-2008, 02:10 PM -
[SOLVED] If a object equals another object, do they contain the same data?
By bobleny in forum New To JavaReplies: 1Last Post: 04-17-2008, 10:10 PM -
Object from String (calling method dynamically)
By Java Tip in forum Java TipReplies: 0Last Post: 02-16-2008, 09:22 PM -
name clash: equals(E) in and equals(java.lang.Object)
By AdRock in forum New To JavaReplies: 0Last Post: 01-25-2008, 11:13 PM
Bookmarks