When creating threads, there are two reasons why implementing the Runnable interface may be preferable to extending the Thread class:
* Extending the Thread class means that the subclass cannot extend any other class, whereas a class implementing the Runnable interface
has this option.
* A class might only be interested in being runnable, and therefore, inheriting the full overhead of the Thread class would be excessive.
No comments:
Post a Comment