hi, when will garbage will be collected if our class contains static methods and non static methods. when it will exactly happen
thanks in advance.
posted 10 years ago
I don't think there is any definitive answer to this because it depends on the garbage collector implementation. My knowledge is limited, but I believe in most modern implementations an object will be eligible for collection when it can no longer be reached from a 'root'. The non-static and static methods have nothing to do with each other in terms of collection. A static member has no effect on when a particular instance of that class may be collected.