ContactUs :

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

Explain how to create a thread and start it running.

Creating a thread:

Declare a class as a sub class of Thread

Class SampleThread extends Thread

{

          Long minSample; {

          SampleThread( Long minSample);

}

          Public void run()

{

          Program goes here

}

}

Run the thread: An instance is created to start the thread.

SampleThread s = new SampleThread(100);

s.start();

 

Related Posts Plugin for WordPress, Blogger...
Flag Counter