This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multithreading  RSS feed

 
Gopal Durairaj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thread is an abstract class;i.e we cannot directly instansiate it.But we create thread instances using new keyword.
How is it possible?
pl explain.
 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thread is not an abstract class. Please check the java api for the definition of the Thread class. Thus an object of Thread can be made by using the "new" keyword.
Regds.
Rahul P. Mahindrakar
 
Rajendra Deshpande
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul,
How does one decide which option to use to create a thread from the 2 given below..
1.Extending the THREAD class
2.Implmenting the 'RUNNABLE' interface.
Thanks and regards,
-Rajendra.
 
sujit singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Rajendra ,
Its upto u to choose. If u have to make a class which must extend from another class eg an applet ,and also u have to use multithreading ,then u have no other option but use Runnable interface. In other cases u are free to choose ur option.
****sujit****
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!