So I've read all about the autocloseable interface and try with resources, but that makes me wonder:
What happens if I do not(forgot) to wrap a class which implements AutoCloseable with a try with resources in a code which uses that class, but that class does take resources from the OS? While there is no guarantee on when JVM will decide it is time to call its garbage collector, when it does, will it call the close() method?
If not,is this where I will miss C++'s destructor? :) Is there a similar way to make sure, from within that class's code and not the user's code, that once the object should be released (for example out of scope) it will release all the OS resources it has taken?