Are resources used by a Java application freed when it terminates?
问题 Java applications may use IO streams, sockets or database connections that should be closed when they are no longer needed. However, applications may be terminated (e.g. by killing the process). Will all used resources be freed in this case? Who will free them: OS or JRE? 回答1: If your software doesn't take care of resource management properly, the following will happen: at runtime: the JVM will attempt during the duration of your program to close open streams if they're are seemingly unused