H
Haitao
Hi all,
I just saw a code fragment written by someone as follows:
public class MyThread extends Thread
{
public void run()
{
... (do something)
}
public static void main(String[] args)
{
Thread t= new MyThread ();
t.start();
... (do something)
}
}
I am new to Java multi-threading program, and haven't seen such a coding
style. Will putting run() and main() in the same class and executing this
class cause some unexpected problems?
Thanks!
I just saw a code fragment written by someone as follows:
public class MyThread extends Thread
{
public void run()
{
... (do something)
}
public static void main(String[] args)
{
Thread t= new MyThread ();
t.start();
... (do something)
}
}
I am new to Java multi-threading program, and haven't seen such a coding
style. Will putting run() and main() in the same class and executing this
class cause some unexpected problems?
Thanks!