Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes equals Method? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "equals Method?" Watch "equals Method?" New topic
Author

equals Method?

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Hi Guys,

Is the equals method overriden in the collection interface or is it the one from the Object class??


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

I think you answered your own question. Since it is an interface how would you go about providing an implementation ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Thanks John...
Sanjeev Singh
Ranch Hand

Joined: Nov 01, 2006
Posts: 381
Is the equals method overriden in the collection interface or is it the one from the Object class??

This first thing to be noted is that interfaces can not override the methods as you quoted it can only declare the methods to be overriden.

The equal() methods in each collection is overrided by the abstract classes which they extends.
java.lang.Object
|--- java.util.AbstractCollection
|--- java.util.AbstractList (equal() is overrided here)
|----java.util.ArrayList
[ December 17, 2006: Message edited by: Sanjeev Kumar Singh ]

~Sanjeev Singh<br />SCJP 1.5
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Sanjeev, thanks for the details.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: equals Method?
 
Similar Threads
equals() to check equality of two objects
How to check the two objects are same?
HashSet ordering
Mock Objects for easymock -- Assertion failure Error
Parameter value