Threads
From Suhrid.net Wiki
Jump to navigationJump to search- Think of Thread as the "worker" and Runnable as the job.
- Define work to be done in a class that implements Runnable.
- Instantiate the thread using the runnable object and then start() it.
class Job implements Runnable {
public void run() {
//work to be performed in a separate thread.
}
}
Job j = new Job();
Thread t = new Thread(j);
t.start();