This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage collection?

 
srikanth reddy
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


here i thought the answer to be 2..

but its not ...can anyone explain me when does the object gets garbage collected exactly??


srikanth
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never in that method . Answer 'c' because , eventhough 'b' is set to null
the reference variable c points to this object and it is returned to the calling place.
[ September 22, 2005: Message edited by: Srinivasa Raghavan ]
 
Lalitha Gottumukkula
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because it is having direct reference (c), it is never garbage collected.
 
srikanth reddy
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes srinivas,

got it ..thanks for your help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic