Reference abstract classes in Java

Source: Internet
Author: User

I. Overview

Located under the JAVA.LANG.REF package, declaration:Publicabstract classreference<t> extends Object

The abstract base class for referencing objects. This class defines the operations that are commonly used for all referenced objects. Because reference objects are implemented in close collaboration with the garbage collector, you cannot create subclasses for this class directly.

Ii. details of the method

1. Public TheTget() returns the indicated object of this reference object. If this reference object is already purged by the program or the garbage collector, this method returns null .


2. Public void Clear () Clears this reference object. Calling this method does not cause the object to be joined to the queue. This method is only called by Java code, and can be manipulated directly when the garbage collector clears the reference, without calling this method.


3. Public Boolean isenqueued () is notified by the program or garbage collector whether this reference object has been added to the queue. If you create this reference object without registering it in the queue, the method will always return false .

return: returned when and only if this reference object is already queuedtrue


4、Public Boolean Enqueue () To add this reference object to the queue to which the reference object has been registered (if any). This method is only called by Java code, and can be manipulated directly when the garbage collector joins the queue, without calling this method.

Returns : returns if this reference object is successfully joined to the queue, true if it is already queued or is not registered in the queue when it is created false .


Reference abstract classes in Java

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.