Re: about static variable



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.
.