aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Main thread terminates when main method exits Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Main thread terminates when main method exits " Watch "Main thread terminates when main method exits " New topic
Author

Main thread terminates when main method exits

Jeganathan Swaminathan
Greenhorn

Joined: Dec 12, 2000
Posts: 5
I gone thru' the maha's discussion regarding thread. There it is clearly written that "MAIN THREAD IS ALIVE TILL ANY CHILD THREAD IS ALIVE" but from the program added below gives a different picture. So i expect some comments on this...


------------------
S.Jeganathan MCA
Software Engg.
PSI Data Systems Ltd.,
Bangalore.
jeganath@psi.soft.net


S.Jeganathan MCA<BR>Software Engg.<BR>PSI Data Systems Ltd.,<BR>Bangalore.<BR>jeganath@psi.soft.net
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

it is because you created a new thread at this line:
t1 = Thread.currentThread();
the method currentThread() returned a Thread which you assigned to t1. now t1 points at the same Thread the JVM is running(which is executing main at the moment).


SCJP
Visit my download page
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

i guess???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Main thread terminates when main method exits