This week's giveaway is in the Beginning Java forum.
We're giving away four copies of Bad Programming Practices 101 (e-book) and have Karl Beecher on-line!
See this thread for details.
Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • 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: 66727
167
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
 
You've gotta fight it! Don't give in! Read this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!