Java Reference abstract class, javareference Abstract

Source: Internet
Author: User

Java Reference abstract class, javareference Abstract

I. Overview

In the java. lang. ref package, declare: public abstract classReference <T>ExtendsObject

The abstract base class of the referenced object. This class defines operations that are commonly used to reference objects. Because the referenced object is implemented through close cooperation with the garbage collector, you cannot directly create a subclass for this class.

Ii. Detailed Methods

1,Public Tget () returns the indicator object of this referenced object. If the referenced object has been cleared by a program or garbage collector, this method returnsnull.


2. public voidClear() Clear the referenced object. Calling this method will not cause the object to be added to the queue. This method is called only by Java code. When the Garbage Collector clears references, you can directly perform operations without calling this method.


3. public booleanIsEnqueued() The program or garbage collector notifies you whether the referenced object has been added to the queue. If this reference object is not registered in the queue when it is created, this method will always returnfalse.

Return Value:Returned only when the referenced object has been added to the queuetrue


4、Public booleanEnqueue() Add this reference object to the queue that the reference object has registered with (if any ). This method is called only by Java code. When the Garbage Collector adds references to the queue, you can directly perform operations without calling this method.

Return Value:If the referenced object is successfully added to the queue trueIf it has already been added to the queue or is not registered in the queue when it was created, the system returns false.


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.