Which method is more preferable to create a thread?

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.

People who read this post also read :


By extending the runnable interface..
Because it allows u to extend ur class with some other class
And It separates the the thread code with ur other code.

There are always many methods of for creating threads. But it is also important to understand that where this need to be created and implemented. Usability for that thread is an important factor.

oracle ebs

Post a Comment


Twitter Delicious Facebook Digg Stumbleupon Favorites More