nikola3103
nikola3103

Reputation: 133

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.

Upvotes: 4

Views: 752

Answers (2)

Vishrant
Vishrant

Reputation: 16688

There are four types of references in Java:

Phantom references are not automatically cleared by the garbage collector as they are enqueued. An object that is reachable via phantom references will remain so until all such references are cleared or themselves become unreachable. more... and example

Upvotes: -1

Andreas
Andreas

Reputation: 159165

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.

Upvotes: 6

Related Questions