Originally posted by Smitha Ballikar:
...this works if a class extends thread but not if class implements runnable...
Note that Runnable is an interface with a
single method, public void run(). The Runnable interface does
not contain a "start" method. So if an object's reference type is Runnable, then start() cannot be called on that object.
The Thread class implements Runnable, providing implementation for the run() method. In addition, Thread defines a start() method. So if an object's reference type is Thread, then both start() and run() are available as methods.
(Of course, calling run() directly will execute that method's body in the current thread, instead of as its own thread.)