JAVA is a special class Object, javaobject

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.