Final answer:
The correct method to make the main thread wait for child threads is the join() method, called on the thread instance you wish to wait for. This ensures that the thread calling join() suspends execution until the specified thread completes.
Step-by-step explanation:
The method used to make the main thread wait for all child threads to complete its execution is d. join(). The join() method is invoked on a thread instance, which causes the current thread to pause execution until the thread it is joined to completes its task. While methods like wait() and sleep() can also pause thread execution, join() is specifically used for the purpose of waiting for another thread to finish. stop() is deprecated and not a safe way to manage thread lifecycles.
For example, if you have a child thread threadB and you want the main thread to wait for this thread to finish, you would use threadB.join() in the main thread. This will ensure that the main thread will only continue after threadB has completed its execution.