• Post Reply Bookmark Topic Watch Topic
  • New Topic

how can a thread invoke an overloaded run

 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I am trying to work on an overloaded run method .
eg:- I have a class userRunnable which implements the run and also gives definition for overloaded run ie public void run(long milliseconds ) {} now in my main i create a thread and want to invoke the overloaded run for my thread . can anyone explain how my thread will overloaded run instead of the no argument run after start method is invoked .
 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the answer folks . We need to create a constructor for the userRunnable and intialize the argument for overloaded run in it . From the run method we can call the overloaded run and then in main we can also create the userRunnable object and invoke start on it .
i am including the code as follows:-
 
Vijitha Kumara
Bartender
Posts: 3952
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any specific requirement that you'd like to share that you wanted to do this?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!