Looks both does releasing memory/non-memory resources. Which is the right option for releasing memory intensive resources ?
Stephan van Hulst
posted 6 years ago
Finally and finalize are two completely different mechanisms.
The latter is intended as a safety net to release resources held by the object, if they weren't explicitly released by the client. You should never call finalize(); and you rarely have a good reason to override it.
Finally on the other hand, can be used to release resources held locally by a method. Always use finally to release resources.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.