This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
hi ,friend As you kbnow that java does not support multiple inheritance so that when you can write coding for applet then you extends the applet class ,in such a case you can't extends the Thread.so that to avoid this kinds of problem you have to implements the Runnable. I think this is sufficient for your understanding. Thanks . if i am wrong then mail me. vishad20002001@yahoo.com Bye.
Jerry Pulley
Ranch Hand
Joined: Sep 19, 2000
Posts: 221
posted
0
Landon, The only good reason to derive a subclass from Thread is to extend its behavior - just like any other class. It's usually a better idea to implement Runnable. Delegation, when it satisfies the requirements, is a more flexible solution than specialization. While it's true that overriding run() is in some sense extending Thread's behavior, it's more in keeping with good OO practice to derive a Thread subclass only if you need to modify some more basic aspect. In the simple example programs you see in most books (where the author often just makes the main class a subclass of Thread), the two approaches are equivalent. In larger programs, this kind of failure to make the code reflect the design abstractions often leads to trouble. Just my opinion, of course. Jerry