• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Any more difference between Thread and Runnable?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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{
}
?
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bikramjit,
Great!!!, thanks for reply.
-Gayatri
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic