0

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?

1
  • 2
    Yes, it's a normal reference. If you get the object and keep a normal reference to it, then it will not be garbage collected. Commented Sep 28, 2020 at 8:54

2 Answers 2

2

Yes

Default references are strong references

You have some more information in this other question

Sign up to request clarification or add additional context in comments.

Comments

2

Your weakObj is a WeakReference, and yes, get() returns a standard reference.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.