Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
For example,
WeakReference<Obj> weakObj = new WeakReference<>(obj); Obj obj2 = weakObj.get()
In this example obj2 is strong reference type?
If yes means GC is not able to remove this reference until its parent get GCed?
get
Yes
Default references are strong references
You have some more information in this other question
Add a comment
Your weakObj is a WeakReference, and yes, get() returns a standard reference.
weakObj
WeakReference
get()
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
getthe object and keep a normal reference to it, then it will not be garbage collected.