File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes Defining threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Defining threads" Watch "Defining threads" New topic
Author

Defining threads

Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 191
Hi.

I am new to threads and was wondering:

My program is running as a single thread i.e. there is no thread defined - it just runs. Now, I need to create a new thread which I have done succesfully ( i think ). What I would like to know is that if my main program requires a new thread to run as above, so that two things can run concurrently, should I define what was previsouly the main program as a thread as well - or is just defining the new thread i need enough?

Thanks,

Sam


Moosey knows best
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18120
    
  39

The main() method is called using the main thread -- which is already a thread.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 191
I see. Thanks Henry.
Maris Orbidans
Ranch Hand

Joined: Mar 08, 2004
Posts: 149
a new thread is enough
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Defining threads
 
Similar Threads
Threads
How to kill an slepping thread ?
Another One from Threads...
Threads - enough is enough
Daemon threads & non daemon Threads