如下代码创建一个新线程并启动线程 问:四个选项中可以保证正确代码创建target对象 并能编译正确
已帮助 人
如下代码创建一个新线程并启动线程,问:四个选项中可以保证正确代码创建target对象,并能编译正确的是() public static void main(String[] args) { Runnable target=new MyRunnable(); Thread myThread=new Thread(target); }
A.public class MyRunnable extends Runnable { public void run() { } }
B.public class MyRunnable extends Runnable { void run() { } }
C.public class MyRunnable implements Runnable { public void run() { } }
D.public class MyRunnable implements Runnable { void run() }

回答
共1条回复-
Thread th=new Thread(this);th.start();
