Class java.lang.Object
All Packages    This Package    Previous    Next

Class java.lang.Object

java.lang.Object

public class Object
The root of the class hierarchy. Every class in the system has Object as its ultimate parent. Every field and method defined here is available in every object.
See Also:
Class
Version:
1.15, 31 Jan 1995

Object()

clone()
Creates a clone of this object.
copy(Object)
Copies the contents of an object into this object.
enterMonitor()
Locks the object.
equals(Object)
Compares two objects for equality.
exitMonitor()
Unlock the object.
getClass()
Returns the Class of this Object.
hashCode()
Returns a hashcode for this object.
notify()
Notifies a single waiting thread.
notifyAll()
Notifies all of the threads waiting for a condition to change.
toString()
Returns a string that represents the value of this object.
wait(int)
Causes a thread to wait until it is notified or the specified timeout expires.
wait()
Causes a thread to wait until it is notified.

Object
  public Object()

getClass
  public final Class getClass()
Returns the Class of this Object. Java has a runtime representation for classes, a descriptor (a Class object), which getClass returns for any object.
Returns:
the class of this object

hashCode

  public int hashCode()
Returns a hashcode for this object. Each object in the java system has a hashcode. The hashcode is a number that is usually different for different objects. It is used when storing objects in hashtables. Note: hashcodes can be negative as well as positive.
Returns:
the hashcode for this object.
See Also:
Hashtable

equals

  public boolean equals(Object obj)
Compares two objects for equality. Returns a boolean that indicates whether this object is equivalent to another object. This method is used when an object is stored in a hashtable.
Parameters:
obj - the object to compare with
Returns:
returns true if the this object is equal to obj
See Also:
Hashtable

copy

  protected void copy(Object src)
Copies the contents of an object into this object. The contents of an object are defined as the values of its instance variables. src must be of the same class as this object.
Parameters:
src - the object which is copied into the current object
Throws: ClassCastException
obj is not of the same type as this object.
See Also:
clone

clone

  protected Object clone()
Creates a clone of this object. A new instance is allocated and the copy(Object) method is called to copy the contents of this object into the clone.
Returns:
a copy of this object
Throws: OutOfMemoryException
Not enough memory
See Also:
copy

toString

  public String toString()
Returns a string that represents the value of this object.
Returns:
a printable string that represents the value of this object

notify

  public void notify()
Notifies a single waiting thread. Threads that are waiting are generally waiting for another thread to change some condition. Thus, the thread effecting the change notifies the waiting thread using notify(). Threads that want to wait for a condition to change before proceeding can call wait().

notify() can only be called from within a synchronized method.

Throws: InternalException
Current thread is not the owner of the object's monitor.
See Also:
wait, notifyall

notifyAll

  public void notifyAll()
Notifies all of the threads waiting for a condition to change. Threads that are waiting are generally waiting for another thread to change some condition. Thus, the thread effecting a change that more than one thread is waiting for notifies all the waiting threads using notifyall(). Threads that want to wait for a condition to change before proceeding can call wait().

notifyall() can only be called from within a synchronized method.

Throws: InternalException
Current thread is not the owner of the object's monitor.
See Also:
wait, notify

wait

  public void wait(int timeout)
Causes a thread to wait until it is notified or the specified timeout expires.

wait() can only be called from within a synchronized method.

Parameters:
timeout - the maximum time to wait in milliseconds
Throws: InternalException
Current thread is not the owner of the object's monitor.

wait

  public void wait()
Causes a thread to wait until it is notified.

wait() can only be called from within a synchronized method

Throws: InternalException
Current thread is not the owner of the object's monitor.

enterMonitor

  public void enterMonitor()
Locks the object. Don't use this! This was needed in the old compiler to implement the synchronize statement.

exitMonitor

  public void exitMonitor()
Unlock the object. Don't use this! This was needed in the old compiler to implement the synchronize statement.


All Packages    This Package    Previous    Next