Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

parameter in threads

 
Mario Gimenez
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you do want? Do you want to pass an integer to a method? Yes that is possible :P
 
Ireneusz Kordal
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Mario Gimenez
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is reading really that hard? Ireneusz has just about given you the complete answer, over 12 hours before your post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic