• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exit of JVM

 
Aru
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Does JVM exits after the main() thread ?
I think it does - True.
But I found that one of the mock test says that some other threads may still be running.
How is this possible ? Can anyone explain.
Your help is appreciated.
Thx in Advance.
Aruna
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does JVM exits after the main() thread?
1) if main() method (main thread) did not start other thread, JVM exits
2) if other (non-daemon) thread was constructed in main() method, and this new thread is still running, JVM will wait until it finishes.
2) if main() method ended and there are only daemon threads running, JVM exits.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic