This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I think the statement in your first program will never be invoked.Because this is a single thread program,the statement will not be invoked before the return of the statement .You know,the statment will never return,we call it "dead loop". ------------------ Java lover from hell! [This message has been edited by Metal Zhang (edited August 21, 2001).]
Java lover from hell!
Joined: Nov 22, 2008
Helo Metal Zhang! I think you missed the point, but I realized that instead of using anonymous thread in start method, I can implement the class from Runnable and do the stuff in run. Stopping thread is still a bugger (especially with vicious classes like StamPeed) ------------------ Antti Barck It Solutions Consultant -- NSD Oy Sun Certified Programmer for the Java™ 2 Platform
Metal Zhang, obj.stop() will be invoked in the main Thread, which is a different Thread from the one started by obj.start(). These two Threads have the same priority and will both share the cpu. Hence obj.stop() WILL be called before obj.start() returns.