javamemory-managementphantom-reference

What is referent in java?


What does referent mean in java language?

I came across this word while reading about phantom references in java but it was not explained there, just used (the word). And I could not find the answer by searching on Google either.

What I could conclude from context is that it is the object that a reference is pointing to, but not sure so I want to make sure what it is.

Edit: as suggested in comments I am adding a context where the word is being used:

The Garbage Collector adds a phantom reference to a reference queue after the finalize method of its referent is executed. It implies that the instance is still in the memory.


Solution

  • I came across this word while reading about phantom references in java but it was not explained, just used

    Assuming you're referring to the javadoc of PhantomReference, the word is explained in the documented methods:

    public PhantomReference(T referent, ReferenceQueue<? super T> q)

    Parameters:
    referent - the object the new phantom reference will refer to

    public T get()

    Returns this reference object's referent.