• Post Reply Bookmark Topic Watch Topic
  • New Topic

a simple question??

 
asheet anand
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone ,
i'm new to threads please tell me what exactly we mean by "target of thread".(in reference to the argument passed in the thread object constructor).
thankx
asheet
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A target for a thread is a reference to an object that implements the runnable interface/extends the Thread class.
Consider an example -

Given this definition, you can use this class as a target for creating a thread as follows -

Hope that helps!

------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The target is a reference to an object that implements Runnable (has a run method.) That is the run method the Thread will execute when it is started.
Take a look at the java.lang.Thread source code to see how it is used.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!