File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread - run() constructor " Watch "Thread - run() constructor " New topic

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
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.
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
I agree. Here's the link:
subject: Thread - run() constructor
jQuery in Action, 3rd edition