Why would you ever implement finalize()?
You could use it as a backstop for an object holding an external resource (socket, file, etc). Implement a close() method and document that it needs to be called. Implement finalize() to do the close() processing if you detect it hasn’t been done. Maybe with something dumped to stderr to point out that you’re cleaning … Read more