Instance methods are never called on a class; they are called on objects. There is no guarantee that the GC process will run at all; if it does run it may not release a particular object, so the number of times finalize()
runs is unpredictable. You would not have finalize()
run 3× or more.
Where did you get that code from
? It is the sort of thing that, if written at work, would guarantee you are looking for a new job