Garbage collection and what happens to resources when a program ends
929204Apr 12 2012 — edited Apr 15 2012Hello everyone,
Could someone tell me what happens to resources when a program ends?
Are resources such as a "java.sql.Connection" or a "java.nio.channels.WritableByteChannel" automatically closed when an application ends?
Also, is there some kind of garbage collection that takes place? According to Effective Java 2nd edition item 7, "It is entirely possible, even likely, that a program terminates without executing finalizers on some objects that are no longer reachable." What happens, then?
Thanks in advance!
Edited by: Jujubi on Apr 12, 2012 10:36 AM