This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Java added syntax sugar for doing this with try(stream) { ... }
and the above Scala snippet is what we use at my day job
Any way, that's the typical idiom for closing files vs. finalizers (there's really no such thing as a destructor on the JVM)
so in the end there will be input streams that will need to be closed by the finalization code i guess
unless you call runFinalization
explicitly (which from Javadoc indicates it'll either run in your thread or block), the finalizers really don't get run