Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call Overload Version of Thread's run method

 
Lennie De Villiers
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The Thread class expect a run() method (no arguments), but how can I let it call a overload method? like run(MyClassName aClass)

Regards,

Lennie
 
Minhaj Mehmood
Ranch Hand
Posts: 400
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well you can create your own overloaded method.


but how you will tell to thread.start() to execute my own overloaded run method??
by default thread.start() will execute no-arg run() method!

 
rushikesh sawant
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have to call overloaded run method on that particular object. it can be done in run() method which the thread recognizes.
 
Minhaj Mehmood
Ranch Hand
Posts: 400
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah you are right rushikesh sawant. now it will become any normal void method
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like this may do what you want:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic