Hot Student Stories

What happens to child thread when you delete main thread during run-time?

Blair Lewis

in Student Loans

1 answer
1 view

1 answer

Daniel King on September 20, 2018

In Java, if the main thread somehow exits then all other threads will stop executing. This generally does not happen, as the main thread wait for all threads to terminate before the main thread itself finishes. The disruption of this process is difficult to do for under a handle, exception or System call.output. If the child thread is also a daemon thread, then the child thread will continue running. If the child thread is a normal thread, then the moment in the System.the exit is called, the child thread also terminates If the method is called join() on the child thread, then the main thread wait until the child is over before executing the System.output

Add you answer