Ways to create a thread and which one is more scalable

 There are 2 ways to create a thread.

i) Extending the thread class:

ii) Implementing the Runnable interface.


As java doesn't support multiple inheritance, So when a class extends Thread class, it cannot extend any other class but when a class implements Runnable interface it can also extend other classes as well.

So, Implementing Runnable interface is more Scalable.



Comments

Popular posts from this blog

Advantages and Disadvantages of Monolithic Architecture

Monolithic Architecture

Eclipse debugging