Object Class

Class Overview


The root class of the Java class hierarchy. All non-primitive types (including arrays) inherit either directly or indirectly from this class.

Public Constructors
Object()
Constructs a new instance of Object.

能改寫的Public Methods 有equals(Object o),hashCode(),toString()。其中equals和hashCode要同時改寫。
Public Methods
booleanequals(Object o)
Compares this instance with the specified object and indicates if they are equal.
final Class<?>getClass()
Returns the unique instance of Class that represents this object's class.
inthashCode()
Returns an integer hash code for this object.
final voidnotify()
Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.
final voidnotifyAll()
Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.
StringtoString()
Returns a string containing a concise, human-readable description of this object.
final voidwait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
final voidwait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.
final voidwait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

Protected Methods
Object    clone()
Creates and returns a copy of this Object.
void    finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.



沒有留言:

張貼留言