Extending Thread Java Help

Extending Thread
The second way to create a thread is to create a new class that extends Thread, and then to create an instance of that lass, The extending class must override the rune I method, which is the entry point fa the new thread, It must also call start to begin execution of the new thread, Here is the preceding program rewritten to extend Thread

This program generates the same output as the preceding version. As you can sem the . child thread is created by instantiating an’ object of NewThread, which is derived from Thread

Notice the call to super( ) inside New Thread. This invokes the following form of the Thread constructor The Complete public Thread(String threadName) Here, brand Name specifies the name of the thread.

JavaHelpOnline.com

  • Feel free to send us an inquiry, we will reply back in hours.
 

Verification

Posted on September 17, 2014 in The Complete Reference

Share the Story

About the Author

Back to Top
Share This