Saturday, 15 July 2017

After having started a child thread, how do we wait in the parent thread for the termination of the child thread?

Waiting for a thread’s termination is done by invoking the method join() on the thread’s instance variable: --
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
}
});
thread.start();
thread.join();
view raw gistfile1.txt hosted with ❤ by GitHub

No comments:

Post a Comment