从我在Java
中使用线程的时间开始,我发现了这两种编写线程的方法:
与实现#0:
public class MyRunnable implements Runnable {public void run() {//Code}}//Started with a "new Thread(new MyRunnable()).start()" call
或者,与扩展#0:
public class MyThread extends Thread {public MyThread() {super("MyThread");}public void run() {//Code}}//Started with a "new MyThread().start()" call
这两个代码块有什么显著的区别吗?