jQuery in Action, 2nd edition
The moose likes Threads and Synchronization and the fly likes override start() 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 » Threads and Synchronization
Reply Bookmark "override start() method" Watch "override start() method" New topic
Author

override start() method

pankaj patil
Ranch Hand

Joined: Dec 19, 2004
Posts: 98
hi

if i override start() method in both the way of creating the thread
ie extend Thread and implements Runnable

then sholud i call run() explicitly in both the start() method .

With Regards
Pankaj


Regards,
Pankaj Patil
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
You do not override start() method either way. If you extend Thread, you override run() and if you implement Runnable, you implement run() method.

1. Do not call run() explicitly. It does not spawn a new Thread. It will then be treated as a normal method call and will be run in the same Thread.
2. Do not override start() method. Leave it alone!. Just call it on the Thread object to spawn a new Thread.
[ October 05, 2005: Message edited by: Sravan Kumar ]

keep smilin :: sravan<br /><a href="http://sravanpens.blogspot.com" target="_blank" rel="nofollow">I scribble here</a>
pankaj patil
Ranch Hand

Joined: Dec 19, 2004
Posts: 98
Thanks for reply
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: override start() method
 
Similar Threads
start() method in Thread
Thread Execution
Thread.start()
thread
about starting a new Thread