Originally posted by Dee Irun:
Thread t2 = new Thread(g, "thread");
t2.setName("t2");
Hi,
t2 will execute MyThread's run() only if you provide MyThread instance as the target to t2 while creating it, as in
Thread t2 = new Thread(g, new MyThread(), "thread"); If you do not provide a target that implements run(), then Thread's run() will be executed.
-------------------------------------------
public class Thread
extends Object
implements Runnable
void run()
If this thread was constructed using a separate Runnable run object, then that Runnable object's run method is called; otherwise, this method does nothing and returns.
---------------------------------------------
- Soumya.
[ April 26, 2005: Message edited by: soumya ravindranath ]