Re: about static variable
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Mon, 31 Oct 2005 04:17:36 GMT
On Mon, 31 Oct 2005 02:48:47 GMT, "George2 via JavaKB.com"
<u14844@uwe> wrote, quoted or indirectly quoted someone who said :
>I have heard that static variable will make the program consume very much
>memory. It is because garbage collector (GC) will not work on static variable.
>Is that correct?
Statics are not normally garbage collected, unless you use an advanced
technique called custom class loaders. But this is no reason to avoid
them. If you want to pursue this further see
http://mindprod.com/jgloss/gc.html and follow links.
You normally don't have a choice whether to use static or instance
variables. If you have Dog class, facts about all dogs are static
and about specific dogs are instance.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.
- References:
- about static variable
- From: George2 via JavaKB.com
- about static variable
- Prev by Date: Re: alternative ways to execute a jar application
- Next by Date: Re: network is hindering my applet
- Previous by thread: about static variable
- Next by thread: Re: about static variable
- Index(es):