• Post Reply Bookmark Topic Watch Topic
  • New Topic

Garbage Collection  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when the objects are declared with static modfier, will it be garbage collected? when there is no reference from active stack frame.
 
Author and ninkuma
Marshal
Posts: 66525
160
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"baskar d", please check your private messages for an important administrative matter.
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by baskar d:
when the objects are declared with static modfier, will it be garbage collected? when there is no reference from active stack frame.



Objects cannot be static or non-static. Object references are static or non-static.

An object will be garbage collected some time after the last reference to it has gone away. It doesn't matter whether those references are static or non-static.
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!