ExecutorService executorService = Executors.newFixedThreadPool(5); // Submitting 5 tasks to the executor for(int i=0; i<5; i++) { executorService.execute(new MyTask()); } executorService.shutdown(); // Checking whether all the tasks have completed execution or not while(!executorService.isTerminated()) {} System.out.println("All tasks are completed!");In this example, we create an ExecutorService with a fixed thread pool of size 5. We submit 5 tasks to the executor and then shutdown the executor. After that, we use the isTerminated() method in a while loop to wait until all the tasks have completed execution. Finally, we print a message to indicate that all the tasks are completed. The java.util.concurrent package is a library that provides high-level concurrency utilities, so it can be used in any Java project that requires concurrent programming.