e martë, 12 qershor 2007

Diff between Thread and Runnable implementation.

1) In your application, when you are already extending your class to some base class for inheritance and want to implement threading, then will have to implement the Runnable interface, coz you can extend only one class at a time, while you can implement multiple interfaces.

2) Runnable interface has only one method -run(), so if you want to override more methods for customizing the threading implementation, you need to extend the Thread class, coz Thread class has all the methods and allows to override them.

Nuk ka komente: