Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

What is the 2 way of creating a thread ? Which is the best way and why?
Two way of creating the thread in java are:
 * Extending the Thread class
 * Implementing the Runnable Interface.

Both ways provides the same functionality. But it
is better to implement the Runnable interface, 
because if you extends the Thread class you will
not be able to extend any other class. One class
can extends only a single class but can 
implements many interfaces.