Here, only object "LinkedList" is garbage collected. Even after lhs=null, c and c1 are still pointing to Collectionss objects. In Java strings are also objects so you can say strings "ma", "ba", "co" and "de" are also garbage collected!
Hope it helps.
"Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
Joined: Oct 04, 2004
Nitin so can we say five objects are garbage collected.