The Artima Developer Community
Sponsored Link

Java Answers Forum
boolean equals(Object) and interfaces

1 reply on 1 page. Most recent reply: Jan 27, 2003 7:06 PM by Jim

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Adelbert Groebbens

Posts: 1
Nickname: adelbert
Registered: Jan, 2003

boolean equals(Object) and interfaces Posted: Jan 24, 2003 9:23 AM
Reply to this message Reply
Advertisement
does
boolean equals(Object)
belongs in some interfaces or should it never be used in interfaces ?

what if an object that is going to implementing such an interface has already another
equals
method ?

what is a good way to seperate and
implement the following (for an object implementing
a given interface) :
- equality as far as the information related to the interface
is concerned
- equality as far as all information in the object is
concerned

Adelbert Groebbens


Jim

Posts: 1
Nickname: weejim
Registered: Jan, 2003

Re: boolean equals(Object) and interfaces Posted: Jan 27, 2003 7:06 PM
Reply to this message Reply
boolean equals(Object)
belongs to java.lang.Object

equals(Object) is meant to compare an objects not interfaces

you may want to override the
public int hashCode()
from java.lang.Object too.

see javadocs for java.lang.Object for more detailed.

Flat View: This topic has 1 reply on 1 page
Topic: Need help with dates Previous Topic   Next Topic Topic: homework help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use