📅  最后修改于: 2020-11-15 03:03:05             🧑  作者: Mango
java.lang.Object类是类层次结构的根。每个类都有Object作为超类。所有对象(包括数组)都实现此类的方法。
以下是java.lang.Object类的声明-
public class Object
Sr.No. | Constructor & Description |
---|---|
1 |
Object() This is the Single Constructor. |
Sr.No. | Method & Description |
---|---|
1 | protected Object clone()
This method creates and returns a copy of this object. |
2 | boolean equals(Object obj)
This method indicates whether some other object is “equal to” this one. |
3 | protected void finalize()
This method is called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
4 | Class> getClass()
This method returns the runtime class of this Object. |
5 | int hashCode()
This method returns a hash code value for the object. |
6 | void notify()
This method wakes up a single thread that is waiting on this object’s monitor. |
7 | void notifyAll()
This method wakes up all threads that are waiting on this object’s monitor. |
8 | String toString()
This method returns a string representation of the object. |
9 | void wait()
This method causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. |
10 | void wait(long timeout)
This method 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. |
11 | void wait(long timeout, int nanos)
This method 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. |