What are the methods in OBJCT?

Source: Internet
Author: User

Unlike the C + + language, the Java language is a single-rooted inheritance structure language, meaning that all classes in Java have a common ancestor. This ancestor is the object class. Structure of the object class
The object class has 12 member methods, which can be divided into the following categories according to usage
1, constructor
The 2,hashcode and Equale functions are used to determine if the object is the same
3,wait (), wait (long), wait (Long,int), notify (), Notifyall ()
4,tostring () and GetClass,
5,clone ()
6,finalize () is used in the garbage collection function to describe the purpose of the Clone () clone () function to save a currently existing object. Hashcode () and Equale ()
Equale () is used to confirm that two objects are the same.
Hashcode () is used to get the hash value of the object, the function of this value is to retrieve, the specific function can refer to here
Objects with the same hash value do not necessarily equale ()
Equale () Two objects that return true must be the same.
ToString () and GetClass () ToString () return a string object that identifies itself
GetClass () Returns a class object that, if printed, finds that the result is the following format class Package.name.xxx 1 because a class object is returned, followed by the class method. Whose constructor is used, then the GetClass return is the type.
GetClass () is often used for the Java Reflection Mechanism wait (), wait (long), wait (Long,int), notify (), Notifyall ()
These functions embody the multithreading mechanism of Java
Required to be used in a synchronize statement when used
Wait () is used to get the current thread out of operation and the current thread enters the wait sequence
Notify () A thread that randomly notifies a lock holding an object to get operation permissions
Notifyall () The thread that is used to notify all the locks that hold the object gets operation permissions
Wait (long) and wait (Long,int) are used to set the time interval at which locks are currently released when the next lock is acquired
Finalize () This function will be used for garbage collection, the anonymous object will be called before the collection, specific examples
---------------------
Two ceremonies
Source: CSDN
Original: 53468038?utm_source=copy
Copyright NOTICE: This article is for bloggers original article, reprint please attach blog link!

What are the methods in OBJCT?

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.