stixwix said:
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.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation