java - What happens if a thread opens a socket and the main program exits? -


this question has answer here:

what happens if thread opens socket , main program exits? have seen threads run second or 2 after main program exits, socket thread opened closed when main program exits, or when thread cleans dies?

when program (ie. jvm process) stops, resources released. if there system.exit() call made, jvm stops. if on other hand, main thread finish execution, jvm continues run until there no more non-daemon threads running. if thread handles socket communication non-daemon thread, continue run.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -