aspose file tools*
The moose likes Java in General and the fly likes Thread Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Thread Object" Watch "Thread Object" New topic
Author

Thread Object

Aruna Balasuriya
Ranch Hand

Joined: Nov 14, 2009
Posts: 44
Are Thread objects are like any other Objects of java.
Hiruka Sandev
Greenhorn

Joined: Nov 22, 2009
Posts: 11
Yes. Like all other classes, the Thread class too extends from the Object class. So it can be considered and treated as a 'normal object' in java.
Aruna Balasuriya
Ranch Hand

Joined: Nov 14, 2009
Posts: 44
Hiruka Sandev wrote:Yes. Like all other classes, the Thread class too extends from the Object class. So it can be considered and treated as a 'normal object' in java.


Then upon calling a start method of a thread object how a new method stack generated.
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
Aruna Balasuriya wrote:Then upon calling a start method of a thread object how a new method stack generated.


Why don't you take a look at Thread's sources..? It's in src.zip in our JDK installation folder! You will see that the method that starts the new thread of execution is a native method:

Hiruka Sandev
Greenhorn

Joined: Nov 22, 2009
Posts: 11
To simply put it, that is how the start method in the Thread class has been implemented.

You may implement your class to do anything that you like, but that doesn't mean that an instance of your class cannot be considered to be a regular object in java.

For example say that you have written a class which has a method that writes a record to a DB when that method is invoked. Would you not consider an instance of your class to be like any other object in Java?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread Object