Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

equals method contract in JLS

Thread view: 
stixwix - 12 Dec 2005 14:57 GMT
Hi,
I can't find mention of the equals contract in the Java Languge Spec.
Does anyone know where it is and does anyone know of a searchable
version of this document. (I suppose we shoud all know it so well that
this is pointless!).
Thanks,
Andy
stixwix - 12 Dec 2005 15:30 GMT
Yes, Sun was a good place to look for a searchable version! (Doh).
And, indeed, the equals contract is not in the JLS.  I know it's in the
API for Object but am surprised it's not in the JLS.
Chris Smith - 12 Dec 2005 15:36 GMT
> I can't find mention of the equals contract in the Java Languge Spec.
> Does anyone know where it is and does anyone know of a searchable
> version of this document. (I suppose we shoud all know it so well that
> this is pointless!).

The most relevant section of the JLS (3rd ed) is 1.3, which states:

   "As noted above, this specification often refers to classes of the
    Java and Java 2 platforms.  In particular, some classes have a
    special relationship with the Java programming language.  Examples
    include classes such as Object, Class, ClassLoader, String, Thread,
    and the classes and interfaces in package java.lang.reflect, among
    others.  The language definition constrains the behavior of these
    classes and interfaces, but this document does not provide a
    complete specification for them.  The reader is referred to other
    parts of the Java platform specification for such details API
    specifications."

In other words, the JLS doesn't define this.  Instead, the contract for
equals is specified in the API specification (also known informally as
api docs, or javadocs) for the Object.equals method.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.