Copyright © 2001 Qusay H. Mahmoud
9
Creating and Starting Threads
l
There are two ways to create a thread in Java
–
Extending the
Thread
class
–
class MyThread extends Thread {
–
….
–
public void run() {
–
….
–
}
–
public static void main(String argv[]) {
–
MyThread t1 = new MyThread();
–
t1.start();
–
}
–
}
–