How it works...

You will notice that three threads (thread 3, thread 4, and thread 5) are created. These are then paused by making them sleep for various amounts of time. After each thread wakes, the code waits for all three threads to complete before continuing the execution of the application code.