国家开放大学 / java语言程序设计
下列代码创建一个新线程并启动线程。
Runnable target=new MyRunnable();
Thread myThread=new Thread(target);
其中,( )类可以创建target对象,并能编译正确。
A. public class MyRunnable extends Object { public void run() {} }
B. public class MyRunnable implements Runnable {public void run() {}}
C. public class MyRunnable extends Runnable {void run() {}}
D. public class MyRunnable extends Runnable { public void run(){} }
Runnable target=new MyRunnable();
Thread myThread=new Thread(target);
其中,( )类可以创建target对象,并能编译正确。
A. public class MyRunnable extends Object { public void run() {} }
B. public class MyRunnable implements Runnable {public void run() {}}
C. public class MyRunnable extends Runnable {void run() {}}
D. public class MyRunnable extends Runnable { public void run(){} }
参考答案:
佳题速递: