JAVA is a special class Object, javaobject
A special class
Object: it is the direct or indirect parent class of all objects in java. The root parent class (base class) defines the function that all objects should have (all classes, are inherited from this class)
Remember: when defining a new class, it does not specify to inherit a class. It inherits the Object class by default.
= The equals in the object actually compares the two objects with the same memory address
The object contains the following methods:
Method Summary |
protected Object |
clone() Create and return a copy of this object. |
boolean |
equals(Object obj) Indicates whether another object is "equal" to this object ". |
protected void |
finalize() When the Garbage Collector determines that there is no more reference to this object, the object's garbage collector calls this method. |
Class<?> |
getClass() Return thisObject . |
int |
hashCode() Returns the hash value of the object. |
void |
notify() Wake up a single thread waiting on this object monitor. |
void |
notifyAll() Wake up all threads waiting on this object monitor. |
String |
toString() Returns the string representation of the object. |
void |
wait() Thenotify() Method ornotifyAll() Method, causing the current thread to wait. |
void |
wait(long timeout) Thenotify() Method ornotifyAll() Method, or the current thread waits until the specified time is exceeded. |
void |
wait(long timeout, int nanos) Thenotify() Method ornotifyAll() Method, or other threads that interrupt the current thread, or have exceeded a certain amount of time, causing the current thread to wait. |