I am trying to understand how Executor.submit(Runnable) works. Suppose we create a thread pool of size 2 using ExecutorService.
We have a class called Runner implements Runnable.
ExecutorService.newFixedThreadPool(2);
for (int i = 0; i <5; i++){
ExecutorService.submit(new Runner());
}
When we do new Runner() are we not creating 5 threads already?
So how does ExecutorService help in this case?