Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread - run() constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread - run() constructor " Watch "Thread - run() constructor " New topic
Author

Thread - run() constructor

Rashid Ali
Ranch Hand

Joined: Jan 16, 2001
Posts: 349
Can an argument be passed to run() method of thread like run( int i ) and through which method the value can be passed to its variable i because we don't call thread method run() instead it is called through start() method.
Here is the scenario:
class A implements Runnable and it's initialized in class Thread's constructor with the value of argument declared in run(int i) method.
Please clarify.
thanks and best regards
Rashid Ali
anand raman
Ranch Hand

Joined: Jun 06, 2001
Posts: 66
hi
You cant pass in a parameter to the run method, because if you do so in the code, you will end up overloading the method rather than overriding it.
-Anand
Rashid Ali
Ranch Hand

Joined: Jan 16, 2001
Posts: 349
Thanks very much for your quick reply.
It suffice my querry.
Kind regards
Rashid Ali
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Thread - run() constructor
 
Similar Threads
Constructors
Passed SCJP 2 with 91%
Passed with 84%. Some tips...
why there is no argument thread constructor?
SCJP5.0 passed!!