1 import java.util.concurrent.*; 2 3 public class ExecutorDemo { 4 public static void main(String[] args) { 5 // Create a fixed thread pool with maximum three threads 6 ExecutorService executor = Executors.newFixedThreadPool(3); 7 8 // Submit runnable tasks to the executor 9 executor.execute(new PrintChar('a', 100)); 10 executor.execute(new PrintChar('b', 100)); 11 executor.execute(new PrintNum(100)); 12 13 // Shut down the executor 14 executor.shutdown(); 15 } 16 }