Thread vs Executor in Java
Thread & Executor both are used to execute code in
parallel.
you can create and start your own thread
either by extending java.lang.Thread class or implementing java.lang.Runnable
interface. While on other hand, Executor is an interface which also provides
parallel execution but via Thread pool.
Main difference
between Thread and Executor is that java.lang.Thread is a class in
Java while java.util.concurrent.Executor is an interface.
Thread & Executor both are used to execute code in parallel.
you can create and start your own thread either by extending java.lang.Thread class or implementing java.lang.Runnable interface. While on other hand, Executor is an interface which also provides parallel execution but via Thread pool.
Main difference between Thread and Executor is that java.lang.Thread is a class in Java while java.util.concurrent.Executor is an interface.
No comments:
Post a Comment