public class Object
Object
Object
Class
|
---|
|
|
|
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public final Class <?> getClass()
Object
Class
static synchronized
Class
Literals, section 15.8.2 of The Java™ Language Specification .
public int hashCode()
HashMap
hashCode
equals
equals(Object)
hashCode
equals(java.lang.Object)
hashCode
equals(java.lang.Object)
System.identityHashCode(java.lang.Object)
public boolean equals( Object obj)
x
x.equals(x)
true
x
y
x.equals(y)
true
y.equals(x)
true
x
y
z
x.equals(y)
true
y.equals(z)
true
x.equals(z)
true
x
y
x.equals(y)
true
false
equals
x
x.equals(null)
false
obj
true
false
hashCode()
HashMap
protected Object clone() throws CloneNotSupportedException
x
x.clone() != x
x.clone().getClass() == x.getClass()
true
x.clone().equals(x)
true
CloneNotSupportedException
Cloneable
clone
Cloneable
public String toString()
toString
getClass().getName() + '@' + Integer.toHexString(hashCode())
public final void notify()
wait
synchronized
Class,
IllegalMonitorStateException
notifyAll()
wait()
public final void notifyAll()
wait
IllegalMonitorStateException
notify()
wait()
public final void wait(long timeout) throws InterruptedException
notify()
notifyAll()
notify
notifyAll
timeout
wait
wait
wait
T
wait
synchronized (obj) { while (<condition does not hold>) obj.wait(timeout); ... // Perform action appropriate to condition }
timeout
IllegalArgumentException
IllegalMonitorStateException
InterruptedException
notify()
notifyAll()
public final void wait(long timeout, int nanos) throws InterruptedException
notify()
notifyAll()
1000000*timeout+nanos
notify
notifyAll
timeout
nanos
synchronized (obj) { while (<condition does not hold>) obj.wait(timeout, nanos); ... // Perform action appropriate to condition }
notify
timeout
nanos
IllegalArgumentException
IllegalMonitorStateException
InterruptedException
public final void wait() throws InterruptedException
notify()
notifyAll()
wait(0)
synchronized (obj) { while (<condition does not hold>) obj.wait(); ... // Perform action appropriate to condition }
notify
IllegalMonitorStateException
InterruptedException
notify()
notifyAll()
protected void finalize() throws Throwable
finalize
Throwable
Exception