Thread class defines several methods that can be overriden
by the the extending class. But to create a thread we must override the run()
method. Same applies to Runnable
as well.
However Runnable
is a preferred method of creating a thread. The primary reasons are:
Since Runnable is an interface, you can extend other classes. But if you extend Thread then that option is gone.
If you are not modifying or enhancing a whole lot of
Thread
functionalities and extending theThread
class is not a preferred way.