Hi Yuki and Kriti
so, when extending a thread, we say override the run() method. And for implementing Runnable, we can either say implement run() method or override the run() method. Or both ways can only be overriding the run() method.
When you are implementing an interface you
neccessarily impliment the methods. The reasons is the methods are
abstract implicitely. Ofcourse, while impliment you may
skip some methods and not impliment them, then in such a situation you need to declare the implimenting class as an abstract class.
Focussing on the current question. Runnable interface has just
one method viz., <code>
run()</code>. So , when you are implementing multithreading by implimenting the "Runnable" you
"implement" the
run() method. What you are doing in this case is defining it (as it already declared in the interface). On the other hand, in case of extending "Thread" you overide the
run() method as in the Thread class we already have a body
of the
run() method which does nothing.
Hope this clears the doubt.
Ravindra Mohan.