aspose file tools*
The moose likes Threads and Synchronization and the fly likes parameter in threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "parameter in threads" Watch "parameter in threads" New topic
Author

parameter in threads

Mario Gimenez
Ranch Hand

Joined: Mar 23, 2010
Posts: 38
Hi.
I don't know how put a parameter for something like this:

Pseudo-code:


this its possible??

Anybody knows another way to do this???

Thanks in advance...
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

What you do want? Do you want to pass an integer to a method? Yes that is possible :P


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
Mario Gimenez
Ranch Hand

Joined: Mar 23, 2010
Posts: 38
Here is the project how send one message.



Now I want to use this to send many messages (whit threads or another ways....),
Because I need change a part of the message in each call I need pass a string parameter via Thread.
Because I need to know if its possible pass a String parameter to a thread.

for example...

>>Main..
for (x= 0; x< 50; x++){
Thread t = new Thread(x);
t.start();

}

>>run
MyClass mc = new MYclass();

mc.sendMessage(x); ----> this method it will replace the main method in the code I wrote before.



I hope I describe my doubt.




Thanks a lot.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19723
    
  20

Is reading really that hard? Ireneusz has just about given you the complete answer, over 12 hours before your post.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: parameter in threads