File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage collection?

 
srikanth reddy
Ranch Hand
Posts: 252
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes srinivas,

got it ..thanks for your help
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic