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