0
example of thread and use !!
5 Réponses
0
Threads are implemented in the form of objects that contain a method called run().
The run() method is the heart and soul of any thread.
public void run()
{
/* Your implementation of thethread here*/
}
0
if i write run() methods then it automatically becomes thread ?. i dnt understand .. explain plz !!
0
or simply give an example
0
The run() method should be invoked by an object of the concerned thread.This can be achieved by creating the thread and initiating it with the help of another thread method called start().
A new thread can be created in two ways:
1. By creating a thread class:
Define a class that extends Thread class and override its run() method with the code required by the thread.
2. By converting a class to a thread:
Define a class that implements Runnable interface.The runnable interface has only one method, run(), that is to be defined in the method with the code to be executed by the thread.
0
thnx bro :-)