aspose file tools
The moose likes Java in General and the fly likes regarding thread run method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "regarding thread run method" Watch "regarding thread run method" New topic
Author

regarding thread run method

rajareddy annavaarm
Ranch Hand

Joined: Mar 15, 2007
Posts: 96
Why cant we call run method in thread class directly?why we are calling it indirectly by start method?
rajaraman navaneethan
Ranch Hand

Joined: Feb 26, 2005
Posts: 86
Hi Rajareddy,
When you call the run method directly a separate call stack is not created and it runs as a part of the same call stack from the method which it is called.Eventually it doesnt run concurrently with other threads.

regards,
Raja
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Yes, the answer is that you can call run() method, just like any other method. But that runs it in the current thread. If you want to run it in another thread, you must use the API of Thread class to start a new thread, which will then call run() in the new thread.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: regarding thread run method
 
Similar Threads
why we need to override run
Thread Again
Thread start( ) method , can only be called once?
Thread Start() method
Why start() method