GeezerVison is showing docs.oracle.com — Object (Java SE 9 & JDK 9 )
-
-
Constructor Summary
Constructors
| Constructor |
Description |
Object() |
Constructs a new object.
|
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods
| Modifier and Type |
Method |
Description |
protected Object |
clone() |
Creates and returns a copy of this object.
|
boolean |
equals(Object obj) |
Indicates whether some other object is "equal to" this one.
|
protected void |
finalize() |
Deprecated.
The finalization mechanism is inherently problematic.
Finalization can lead to performance issues, deadlocks, and hangs.
Errors in finalizers can lead to resource leaks; there is no way to cancel
finalization if it is no longer necessary; and no ordering is specified
among calls to finalize methods of different objects.
Furthermore, there are no guarantees regarding the timing of finalization.
The finalize method might be called on a finalizable object
only after an indefinite delay, if at all.
Classes whose instances hold non-heap resources should provide a method
to enable explicit release of those resources, and they should also
implement AutoCloseable if appropriate.
The Cleaner and PhantomReference
provide more flexible and efficient ways to release resources when an object
becomes unreachable.
|
Class<?> |
getClass() |
Returns the runtime class of this Object.
|
int |
hashCode() |
Returns a hash code value for the object.
|
void |
notify() |
Wakes up a single thread that is waiting on this object's
monitor.
|
void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor.
|
String |
toString() |
Returns a string representation of the object.
|
void |
wait() |
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
void |
wait(long timeout) |
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
void |
wait(long timeout,
int nanos) |
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
-
-
Constructor Detail
-
Object
public Object()
Constructs a new object.
-
Method Detail
-
hashCode
public int hashCode()
Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
HashMap.
The general contract of hashCode is:
- Whenever it is invoked on the same object more than once during
an execution of a Java application, the
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
- If two objects are equal according to the
equals(Object)
method, then calling the hashCode method on each of
the two objects must produce the same integer result.
- It is not required that if two objects are unequal
according to the
equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined
by class Object does return distinct integers for
distinct objects. (The hashCode may or may not be implemented
as some function of an object's memory address at some point
in time.)
- Returns:
- a hash code value for this object.
- See Also:
equals(java.lang.Object),
System.identityHashCode(java.lang.Object)
|