如下代码创建一个新线启动线程,问:四个选项中可以保证正确代码创建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( ) { } }