package demo06; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class pooldemo { public static void main(String[] args) { ExecutorService es = Executors.newFixedThreadPool(2); es.submit(new Runnable() { @Override public void run() { System.out.println(Thread.currentThread().getName()); } }); es.submit(new Runnable() { @Override public void run() { System.out.println(Thread.currentThread().getName()); } }); es.submit(new Runnable() { @Override public void run() { System.out.println(Thread.currentThread().getName()); } }); } }