The finalize() method is called by the garbage collector, after the GC has determined that the object is unreachable, right before the object is collected. And of course, if the finalize() method makes the object reachable, then the object will not be collected.
Additionally, the GC will, at most, call the finalize method once.
Find a copy of Effective Java by Joshua Bloch. It used to be possible to find a .pdf of the 3rd chapter as a sample chapter free of charge. That will tell you about finalize(). Bloch recommends you don't use it for most applications.