This question too is from Marcus green's mock exam. when we extend thread or implement runnable-- isnt it necessary to define the run method?? I can compile and check but what confuses me is how to tackle such a basics- shattering qn in the exam.
I thought the answer would be 1 but it is 4.
(Reformated) [ September 24, 2004: Message edited by: Barry Gaunt ]
posted 11 years ago
If you implement Runnable, you need to define the run, since the Runnable interface has an abstract method run.
However, Thread is not an abstract class, and does implement run. It calls the Runnable if it has one, or else does nothing and returns.
Therefore, you can extend Thread and not implement run, but it won't allow you to utilize it as a separate thread, but you can utilize the class normally.