Sunday, September 7, 2008 | |

Why implementing runnable is better than extending thread?

We all know that there is two ways to implement threading in Java. And everyone say that implementing runnable is better than extending thread. Why is it so? Simple answer...A Java class can extend only one class( Hybrid or Hierarchical inheritance is not supported) but it can implement any number of interfaces. Thus if we extend Thread in a class which require to be an applet or form, it is not possible.
So always implement runnable.

0 comments: