When I should use
class MyThread extends Thread implements Runnable{
//any statement.
}
And what is the significance of using both type of thread creation at a single time.
When I should use
class MyThread extends Thread implements Runnable{
//any statement.
}
And what is the significance of using both type of thread creation at a single time.
You should almost never do that. The type Thread
already implements Runnable
.
The only reason to do this is if you want to be explicit in your source code.
both type of thread creation
There is only one way to create a thread: creating a Thread
instance and invoking its start()
method. Runnable
is just an interface.