jQuery in Action, 2nd edition*
The moose likes Threads and Synchronization and the fly likes object.run() is the thread running? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "object.run() is the thread running?" Watch "object.run() is the thread running?" New topic
Author

object.run() is the thread running?

Vinod Vinu
Ranch Hand

Joined: Aug 30, 2009
Posts: 217
Hi... i have a very basic question about threading. I know that to use threading in our class we need to either implement Runnable interface or extend the Thread class to our class and then call start() to bring the thread into its life cycle. A thread can be brought into its life cycle only after calling is one and only one method i.e. start().




My question is if i call run() directly then what it is doing exactly ? What i think is that it is just calling the run() and working as a normal class method only. And it has not behaving like a thread i.e. not bringing the thread into its life cycle.


Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

That's right. It'll just execute the run() method in the current thread, and no new threads will be created.
Vinod Vinu
Ranch Hand

Joined: Aug 30, 2009
Posts: 217
Thanks buddy ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: object.run() is the thread running?
 
Similar Threads
Chapter 2 (HFSJ) notes , may be useful for anyone
Thread starting sequence
Thread's priority, why doesn't work?
Synchornized Block..
why there is no argument thread constructor?