Java Reference
In-Depth Information
Returns a clone of this object. A clone is a new object that is
a copy of the object on which clone is invoked. Cloning is dis-
cussed in the next section.
public final Class<?> getClass()
Returns the type token that represents the class of this ob-
ject. For each class T there is a type token Class<T> (read as
"class of T") that is an instance of the generic class Class de-
scribed in " The Class Class " on page 399 . When invoked on
an instance of Object this method will return an instance of
Class<Object> ; when invoked on an instance of Attr it will re-
turn an instance of Class<Attr> , and so forth.
protected void finalize() throws Throwable
Finalizes the object during garbage collection. This method is
discussed in detail in " Finalization " on page 449 .
public String toString()
Returns a string representation of the object. The toString
method is implicitly invoked whenever an object reference is
used within a string concatenation expression as an operand
of the + operator. The Object version of toString constructs a
string containing the class name of the object, an @ charac-
ter, and a hexadecimal representation of the instance's hash
code.
Both the hashCode and equals methods should be overridden if you want
to provide a notion of equality different from the default implementation
provided in the Object class. The default is that any two different objects
are not equal and their hash codes are usually distinct.
If your class has a notion of equality in which two different objects can
be equal , those two objects must return the same value from hashCode .
The mechanism used by hashed collections relies on equals returning
 
Search WWH ::




Custom Search