Thank you Henry and Stephen.
As per link,
http://javarevisited.blogspot.in/2014/03/difference-between-weakreference-vs-softreference-phantom-strong-reference-java.html
[code=java]
Counter counter = new Counter(); // strong reference - line 1
WeakReference<Counter> weakCounter = new WeakReference<Counter>(counter); //weak reference
counter = null; // now Counter object is eligible for garbage collection
[/code=java]
Here, when we set counter as null, so, won't it be eligible for GC even if it is a Strong Reference? And, why one should go for a Weak Reference as they can be GC'ed during execution of the program even if we may need them, so, what is the rationale behind using weak references when we don't get the object while we need it?