It's not a secret anymore!
The moose likes Java in General and the fly likes Any more difference between Thread and Runnable? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Any more difference between Thread and Runnable?" Watch "Any more difference between Thread and Runnable?" New topic
Author

Any more difference between Thread and Runnable?

Gayatri Keshkamat
Greenhorn

Joined: Feb 25, 2004
Posts: 4
Is there any more difference between a Thread and Runnable apart from
--Thread is a class which encapsulates a thread of execution in a mutithreading system.
--Runnable is an interface used for multithreading purpose in java and also because java does not support multiple inheritance.
For Eg: class A extends Thread , B {
}
is not possible , so use
class A extends B implements Runnable{
}
?
Bikramjit Singh Bajwa
Ranch Hand

Joined: Nov 23, 2003
Posts: 39
If you are doing stuff with reflection, e.g. loading a class that extends Thread via defineBytes(...) , and there is a security manager, then you will run into trouble because the default thread constructor calls setPriority. In that case, it is better to use Runnable.

Chakk de,
Bikram
Gayatri Keshkamat
Greenhorn

Joined: Feb 25, 2004
Posts: 4
Hi Bikramjit,
Great!!!, thanks for reply.
-Gayatri
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Any more difference between Thread and Runnable?
 
Similar Threads
qus on threads
Thread Vs Runnable
Required information on Threading
Diff between Thread and Runnable
Required information on Threading