• 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