A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
Threads and Synchronization
Diffrence between calling the run() method.
Joined: Nov 06, 2006
Apr 30, 2008 02:49:00
If you extend any thread class , we should override the run method.
We can call that run method by using obj.start() or obj.run().
Just i want to know difference between them .
Is that start() method will create new Thread () ?
Joined: Aug 05, 2005
Apr 30, 2008 03:47:00
Yes. If you call the run method directly then it will be executed by the current thread. By calling start, a new thread is created and run is executed by that thread.
Joined: Oct 30, 2001
Apr 30, 2008 04:22:00
Actually, calling start does not create a new Thread, but it does create a new thread.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: Oct 27, 2005
Apr 30, 2008 08:24:00
As said before, the difference is that start() will execute the run() method on a new thread, and run() will execute on the current thread.
This is a real stinker in examination; run() is called but the question lets you think that start() is called instead.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
subject: Diffrence between calling the run() method.
start() method of the Thread class
Difference Between Calling threads using run() and start()
run() method in thread
Difference between start() and run() method?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015