In java, is it necessary for me to manually close
all AutoCloseable
and Closeable
objects (whether through explicit call or relying on try-with-resources)?
Does the JVM not automatically clean up AutoCloseable
s and Closeable
s when they are no longer being referenced?
Is calling close
explicitly (whether through explicit call or relying on try-with-resources) a manner of etiquette (i.e., recommended but not necessary) and is the reason to avoid indeterministic resource deallocation which would happen otherwise if one relied on the built in GC?